Shell Scripting Tutorial – Part 6

FUNCTIONS & SIGNALS 6.1. Signals Finding the signal man page Your system contains a man page listing all the available signals, but depending on your operating system, it might be opened in a different way. On most Linux systems, this will be man 7 signal. When in...

Shell Scripting Tutorial – Part 5

REPETITIVE TASKS & VARIABLES 5.1. FOR loop How does it work? The for loop is the first of the three shell looping constructs. This loop allows for specification of a list of values. A list of commands is executed for each value in the list. The syntax for this...

Shell Scripting Tutorial – Part 4

 CONDITIONS & INTERACTIVE SCRIPTS 4.1. IF clause General At times you need to specify different courses of action to be taken in a shell script, depending on the success or failure of a command. The if construction allows you to specify such conditions. The most...

Shell Scripting Tutorial – Part 3

GNU 3.1. Interactive editing What is sed? A Stream Editor (sed) is used to perform basic transformations on text read from a file or a pipe. The result is sent to standard output. The syntax for the sed command has no output file specification, but results can be...

Shell Scripting Tutorial – Part 2

BASH ENVIRONMENT 2.1. Initialization System-wide configuration files /etc/profile When invoked interactively with the –login option or when invoked as sh, Bash reads the /etc/profile instructions. These usually set the shell variables PATH, USER, MAIL, HOSTNAME...