Understanding Shell Scripting


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Understanding Shell Scripting
# 1  
Old 10-03-2011
Understanding Shell Scripting

Hi Gurus,

Im new to Shell scripting. I have a shell script which basically sends an email when called thorugh my ETL tool. Wanted to understand the its functionality in detail. Would be great it any one can explain what exactly the commands to
Code:
#!/bin/sh

# Dummy UUCP rmail command for postfix/qmail systems

SENDMAIL="/usr/sbin/sendmail"
IFS=" " read junk from junk junk junk junk junk junk junk relay

case "$from" in
*[@!]*) ;;
      *) from="$from@$relay";;
esac

exec $SENDMAIL -i -f "$from" -- "$@"


Last edited by Franklin52; 10-03-2011 at 03:44 AM.. Reason: Please use code tags, thank you
# 2  
Old 10-03-2011
Code:
#!/bin/sh ---> script header

# Dummy UUCP rmail command for postfix/qmail systems -->comments

SENDMAIL="/usr/sbin/sendmail" -->variable declared and sets a command path
IFS=" " read junk from junk junk junk junk junk junk junk relay

case "$from" in -->case check
*[@!]*) ;; -----> it is checking any @ or ! available in the input
      *) from="$from@$relay";;
esac

exec $SENDMAIL -i -f "$from" -- "$@" --> send mail


Last edited by pludi; 10-03-2011 at 04:30 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Trouble understanding shell scripting (mostly wsname)

Am still learning Scripting and I come across a build command that I don't really understand if /local/bin/wsname 2>/dev/null; then base="`/local/bin/wsname`" export base fi if ; then /local/bin/wsname exit 1 fi WSNAME="$base"/ can some one in light me to what... (1 Reply)
Discussion started by: Wpgn
1 Replies

2. UNIX for Dummies Questions & Answers

[Solved] Need help understanding ksh scripting.

Can any one please tell me where the error in below script. Output is not as per my requirement. if condition not comparing the result of record count of a file with 1. where is the pbm in my script? Appreciate your help.. #!/bin/ksh #Module- #Summary- To move the file to direcotries if... (9 Replies)
Discussion started by: shivadanam
9 Replies

3. Shell Programming and Scripting

Problem with the shell script for understanding

Can Anybody please tell me the meaning of the script: #!/bin/sh str=$@ echo $str | sed 's/.*\\//' exit 0 (6 Replies)
Discussion started by: nixhead
6 Replies

4. Shell Programming and Scripting

Understanding a Shell Script

Hi Guys, I am absolutely a newbie to Solaris 8.0. Following is a piece of code in a script (/bin/sh). Can anybody help me in deciphering this ? Please see my questions after the script code - _____________________________________________________ /bin/rm -f mycron crontab -l | grep -v... (5 Replies)
Discussion started by: angshuman_ag
5 Replies

5. Shell Programming and Scripting

Call Shell scripting from Perl Scripting.

Hi How to call a shell scripting through a Perl scripting? Actually I need some value from Shell scripting and passes in the Perl scripting. So how can i do this? (2 Replies)
Discussion started by: anupdas
2 Replies

6. Shell Programming and Scripting

Need a better understanding of shell scripts

Need a better understanding of shell scripts (14 Replies)
Discussion started by: sureshkumar4737
14 Replies

7. Shell Programming and Scripting

Understanding a Simple Shell Script

#! /usr/bin/ksh old=$1 new=$2 for file in *.$old ; do mv $file ${file%$old}$new done exit 0 This script i got from the forum. script changes the extension of the files say example a.txt to a.doc b.txt to b.doc c.txt to c.doc d.txt to d.doc this scipt works fine but i am not... (2 Replies)
Discussion started by: vijays3
2 Replies

8. Shell Programming and Scripting

Understanding of a script as a scripting newbie

Hi! I have the following script and do not understand part of it. I have a very little understanding of scripting. The script is for Nagios to check the response of fast-com.de. The guy who has written it is no longer in the company. #!/bin/sh PATH=/adm/bin:/bin:/usr/bin export PATH ... (2 Replies)
Discussion started by: locutus01
2 Replies

9. Shell Programming and Scripting

difference between AIX shell scripting and Unix shell scripting.

please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies
Login or Register to Ask a Question