Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logic within for loop

Status
Not open for further replies.

guzler

Technical User
May 28, 2003
10
US
Hello All,

I have script wherein I am sending an email with multiple attachments. If the the file is of .gz then I don't have to anything else I have to do a unix2dos .. How do I do this ..

Here is the script

charset=us-ascii;export charset
for e in *
do
unix2dos $e $e
uuencode $e $e
done| mailx -s "$subject" $address

Any help is highly appreciated ..

Thanks,
Sridhar
 
Try something like this:
Code:
case $e in
*.gz) : OK
*) do something
esac

Hope This Help
PH.
 
Should I do this logic within the for loop .. Can I use a if statement inside the for loop .. How do I do that ..

This is what I need ..

for e in *
if not equal to file extension
then
do
unix2dos $e $e
uuencode $e $e
fi
done| mailx -s "$subject" $address


Thanks in Advance

Sridhar
 
Try something like this:
Code:
for e in *; do
  case $e in
  *.gz) : OK nothing to do;;
  *) unix2dos $e $e; uuencode $e $e;;
  esac
done | mailx -s "$subject" $address

Hope This Help
PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top