By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,571 Members | 966 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,571 IT Pros & Developers. It's quick & easy.

Need Help in Writing Unix Shell scripts

P: 1
Hi all,

I desperately need to learn Unix Shell scripting with in the short span of time. Could anyone of you suggest me the way or what books should I prefer.


Thanks & Regards,
Kishore
Dec 3 '07 #1
Share this Question
Share on Google+
4 Replies

arne
Expert 100+
P: 315
Hi all,

I desperately need to learn Unix Shell scripting with in the short span of time. Could anyone of you suggest me the way or what books should I prefer.


Thanks & Regards,
Kishore
I liked the Advanced Bash Scripting Guide .

HTH,
arne
Dec 4 '07 #2

P: 33
Hi all,

I desperately need to learn Unix Shell scripting with in the short span of time. Could anyone of you suggest me the way or what books should I prefer.


Thanks & Regards,
Kishore
-------------------------
Hi Kishor,

In order to have a starting on shell programming, you can try it with following link:

http://gd.tuwien.ac.at/linuxcommand.org/wss0010.html

It will gives you enough confidance for writing your own scripts too.Once you get it on then for details of shell script programming you can try the following link:-
http://www.esscc.uq.edu.au/~ksteube/Bshell/

Hope that gives you some fruitful results,

Regards,
Raj Kumar Arora
Dec 19 '07 #3

P: 4
Hi all,

I desperately need to learn Unix Shell scripting with in the short span of time. Could anyone of you suggest me the way or what books should I prefer.


Thanks & Regards,
Kishore
don't forget that there are hundreds of shell scripts on your computer now: make search for shell scripts

i can email you a few simple beginner examples that i have done.
Dec 19 '07 #4

P: 4
don't forget that there are hundreds of shell scripts on your computer now: make search for shell scripts

i can email you a few simple beginner examples that i have done.
here's a bourne script that copies a file:


#!/bin/sh
trap 'echo "script ex3 interrupted"; exit' 2 #user of system kills script

# control number of arguments typed after command
# command is name of shell script file, which has to be executable
# ie chmod +x filename

if [ $# -ne 2 ]
then
echo "two arguments expected"
exit 1
fi

allowcopy=no; from=$1; to=$2

if [ -e $from ] # if file exists
then
if [ -e $to ]
then
answer=notgiven
while [ $answer = notgiven ]
do
echo " " $to " exists. replace? "
read wish # input from keyboard
case $wish in
y|Y)
answer=given
allowcopy=yes
;;
n|N)
answer=given
exit
;;
*)
echo "y or n please"
;;
esac
done
else
#the from file exists, the to file doesn't. copy from to
allowcopy=yes
fi
else
# the 'from' file doesn't exist. nothing to copy.
echo file $from " not found. exiting."
exit 1
fi

if [ $allowcopy=yes ]
then
cp $from $to
fi

a few useful things in this bash. hope it helps
Dec 20 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.