
Understanding Variables and Variable Naming Conventions in Shell Scripting
Learn how to create and manage variables in shell scripting, including naming conventions, assignment, and reading variable content. Explore best practices for naming variables and constants, as well as how to perform multiple variable assignments efficiently.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
The Linux Command Line Chapter 25 Starting A Project Prepared by Dr. Reyes, New York City College of Technology
Variables To create a variable use a name followed by the assignment statement (the = symbol) and a value. Leave NO SPACES between the name and the assignment statement, and after the assignment statement and the value No data type needs to be specified, as the shell treats everything as a string by default o name= John Smith o age=19
Variable Names Conventions You may use alphanumeric characters (letter and numbers) and underscore First character must be a letter or underscore Spaces and special characters are not allowed Software Engineering Considerations: o Use camelCase for variables (capitalize the first letter of every word after the first one) o Use ALL CAPS for constants To read the content of a variable use $ and the variable name o i.e. for variable name use $name
Hello Johh Smith Replace John Smith with your name
Multiple Variable Assignment You can assign values in individual lines Or on the Same Line: