What is the syntax for creating a variable in a shell script?

0114

In a shell script, you can create a variable using the following syntax:

variable_name=value

For example, to create a variable named greeting with the value "Hello, World!", you would write:

greeting="Hello, World!"

Note that there should be no spaces around the equal sign (=). To access the value of the variable, you can use the $ symbol:

echo $greeting

0 Comments

no data
Be the first to share your comment!