- There are special scripts that are meant to set up your environment - to run these you must "dot" them:
. command
- Your profile is an example of this type of script and we will look at it together.
We will start writing some shell scripts as we go through the material, so let's get set up now:
- Under your HOME directory, create a directory called cmd.
- cd to that directory and do your work from there.
- Create a file called myll that has the command to do a long listing in the current directory.
- Change its permissions to 755.
- Execute it.
- Go home and execute it twice, once with a relative path and once with an absolute path.
Shell Programming Syntax
- Note: Shell has many standard programming constructs, like ifs, loops, functions, arguments, ... I will post notes on these, but
we will focus on the basics. To learn about all possibilities, read the man page for bash (or whatever flavor of LINUX you are interested in).
Basic Syntax |
|
|
|
More Advanced Syntax |
|
|
Lets Write Some Shell Scripts