1. any text editor like vi , pico etc ...
2. after writing shell script set execute promission for your script like follows
examples:
# if you srcipt is called hello than
Code:
- Code: Select all
$ chmod +x hello
$ chmod 755 hello
|||
|||
||----- this (5) will set read , execute for other
||
||-------- this (5) will set read , execute for group
|
|------------- this (7) will set read , write , execute promissions for owner
3. to execute your shell script use
examples:
Code:
- Code: Select all
$ bash
$ sh
$ ./hello
now lets write some easy script Smiley
type this in your editor
Code:
- Code: Select all
# clears the screen
# echos I made script on screen
clear
echo "hi to all"
save this as hello
now set promissions like
Code:
- Code: Select all
chmod +x hello
chmod 755 hello
and now run script
do this
Code:
- Code: Select all
./hello
new script
Write following shell script, save it, execute it and note down the it's output.
Code:
- Code: Select all
clear
echo "Hello $USER" # say hello to active user
echo "Today is \c ";date # print's date
echo "Number of user login : \c" ; who | wc -l # number of logins
echo "Calendar" # calendar
cal
exit 0
This is simple howto for shell scripts
If there are errors or something correct me
I belive it will be usefull to other members





