How Do You Declare a Variable in Unix Shell Scripting?
Contents How Do You Declare a Variable in Shell Script? Note That There Must Be No Spaces Around the “=” Sign: Var=Value Works; Var = Value Doesn’t Work. in...
How do you declare a variable in shell script?
Note that there must be no spaces around the “=” sign: VAR=value works; VAR = value doesn’t work. In the first case, the shell sees the “=” symbol and treats the command as a variable assignment. In the second case, the shell assumes that VAR must be the name of a command and tries to execute it.
How do you declare a variable in UNIX?
A variable is a character string to which we assign a value. The value assigned could be a number, text, filename, device, or any other type of data. A variable is nothing more than a pointer to the actual data. The shell enables you to create, assign, and delete variables.