Write Shell script:
1) Editor like VI or Mcedi
2) Set Execute permission for your script
chmod permission Your-script-name
chmod +x your-script-namechmod 755 your-script-name
This would set read write execute (7) permission for the owner, for group and other permission are read and execute only (5).
3) Execute Script
Bash your-script-name
SH your-script-name
./Your-script-name
In the last syntax./means current directory, and only. (dot) means execute given command file in current shell without starting the new copy of the shell.
Example:
. Foo
4) Practice
1 $ vifirst 2 #3Shell script4 #5 Clear6echo "knowledge is Power"
1$VI ginfo2#3#4# Script toPrintUser information who currently login, currentDate& Time5#6 Clear7 Echo"Hello $USER"8 Echo"Today is \c";Date9 Echo"Number of User login: \c";Who | wc-lTen Echo"Calendar" One Cal A Exit0
How the Shell script to write