Bourne Again Shell (bash) is the common shell used in Unix/Linux based Operating Systems. Also these days, even Windows OS also comes with an option called Power Shell. This post will list out some basic exercises that a shell can do. Do follow this blog with more number of exercises.
To run a bash file, you can use either of these following commands
- bash file.sh
- sh file.sh
- ./file.sh (in this case the file.sh should be made executable)
For making executable file, use this command chmod 755 file.sh
1. A Shell to Handle a File, rename a given file, compress it and move it to a newfolder and decompress it in the newfolder
2. A shell to find a particular string from a file and redirect it to another file.
3. A shell to read a variable and process it mathematically (use of add operation).
4. A shell to Greet the user based on the system time.
5. A shell to create a menu based system to control multiple commands using case esac block
6. A shell to find the number of document files in a given directory using for loop.
Try running these examples and get the use of SHELL.Pradeep Kumar TS