Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 2.1 KB

Session9.md

File metadata and controls

43 lines (31 loc) · 2.1 KB

Bash scripts

Here are some examples of bash scripts and their funcationalities. Documentation is given as part of the scripts.

script00.sh illustrates the use of special variables in a shell script.

script01.sh lists all the files in /bin which are of the file type "shell script".

script02.sh illustrates the use of expansion to create list of names in a given pattern.

script03.sh lists all the files in four different directories which are of the file type "shell script".

script04.sh lists Fibonacci numbers below an integer given as command line argument.

script05.sh uses gawk to find the sum of sizes of all files in a folder.

script06.sh illustrates use of sed to replace a string.

script07.sh illustrates the use of gawk for column swapping and simple arithmetic operations on a data file t1-data.txt. Download this datafile in the same folder as the shell script before trying it out.

Here are some examples you can try in that sequence to learn shell scripting.