diff options
author | Puneeth Chaganti | 2011-06-10 16:28:35 +0530 |
---|---|---|
committer | Puneeth Chaganti | 2011-06-10 16:28:35 +0530 |
commit | 638d6b456a95c64a71d0584a89404af1a1c2e8dd (patch) | |
tree | d867a1d64cfbf8ae5ac5a11d3a71942b9786e978 /ult/handout.rst | |
parent | 58630bcb4334866b399da831c72e32c6674cd996 (diff) | |
download | sees-638d6b456a95c64a71d0584a89404af1a1c2e8dd.tar.gz sees-638d6b456a95c64a71d0584a89404af1a1c2e8dd.tar.bz2 sees-638d6b456a95c64a71d0584a89404af1a1c2e8dd.zip |
ult: Add content on shell variables and comments.
Diffstat (limited to 'ult/handout.rst')
-rw-r--r-- | ult/handout.rst | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/ult/handout.rst b/ult/handout.rst index a1ea9fb..5ef762a 100644 --- a/ult/handout.rst +++ b/ult/handout.rst @@ -1785,6 +1785,41 @@ So, these are all the paths that are searched, when looking to execute a command. If we put the results.sh script in one of these locations, we could simply run it, without using the ``./`` at the beginning. +Variables +--------- + +As expected, it is possible to define our own variables inside our shell +scripts. For example, + +:: + + name="FOSSEE" + +creates a new variable ``name`` whose value is ``FOSSEE``. To refer to this +variable, inside our shell script, we would refer to it, as ``$name``. +**NOTE** that there is no space around the ``=`` sign. + +:: + + ls $name* + +It is possible to store the output of a command in a variable, by enclosing +the command in back-quotes. + +:: + + count=`wc -l wonderland.txt` + +saves the number of lines in the file ``wonderland.txt`` in the variable +count. + +Comments +-------- + +The ``#`` character is used to comment out content from a shell script. +Anything that appears after the ``#`` character in a line, is ignored by +the bash shell. + Control structures and Operators ================================ |