Contents
How do you print the value of a variable in Linux?
Sh, Ksh, or Bash shell user type the set command. Csh or Tcsh user type the printenv command.
How do you print a variable value in Unix?
To Print the value of above variables, use echo command as shown below :
- # echo $HOME. # echo $USERNAME.
- $ cat myscript.
- #!/bin/bash. # display user information from the system. …
- $ echo “The cost of the item is $15” …
- $ echo “The cost of the item is $15” …
- var1=10. …
- $ cat test3. …
- Running the script produces the following output: