Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # A simple variable example
- myvariable=Hello
- anothervar=Fred
- echo $myvariable $anothervar
- echo
- sampledir=/etc
- ls $sampledir
- # Lines 4 and 6 - set the value of the two variables myvariable and anothervar.
- # Line 8 - run the command echo to check the variables have been set as intended.
- # Line 9 - run the command echo this time with no arguments. This is a good way to get a blank line on the screen to help space things out.
- # Line 11 - set another variable, this time as the path to a particular directory.
- # Line 13 - run the command ls substituting the value of the variable sampledir as its first command line argument.
Advertisement
Add Comment
Please, Sign In to add comment