Compiling a shell script.
To create a new file in unix based environments we can use text editors like vi, vim, emacs, gedit,etc..
If you use vi editor, for compiling and executing a shell script then follow the steps given below,
1. Just open terminal and type as “vi <file_name>.sh” and enter (.sh is extension for shell script)
2. Write required script and save the script by using shift+;(semi-colon) and w.
3. To quit the editor you need to press shift+;(semi-colon) and q. (Note:Both q and w are lower-case)
4. Its no need for you to be logged in as a Root to execute the Shell scripts, Else if you wanna to run
the script with Root then you may use ‘su’ command.
5. To execute type as “sh <file_name>.sh” and enter.
You’re done.
Leave a Reply