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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script sh

Status
Not open for further replies.

swa75

Technical User
Aug 20, 2002
14
0
0
FR
I've written a small script but I don't get what i'd like, I think that the problem comes from a ";" but I don't understant where I made a mistake. Here's the script :

#!/bin/sh
j=0
i=0
for i in fdsfdsf;
do
if gfdgfdgx;
then
cbvcbg;
fi;
done
i=0
if j=6;
then
for i in hjdgjyh;
do
juyirurtjyt;
done



echo "jhgdjhg" >/yeudhg
date >>/yeudhg;


else
if [ gfgqdfg ];
then
gfdsgfd;
fi;
fi

the "if" in green is not true (the "for" in green is not executed) so the "else" should be executed, but the text in red is executed...
where is the problem?

could someone help me???? (I hope this is the right forum)
 
Hi,

Remove all the ";" you put at then end of lines. They are usefull only if you have more that 1 instruction per line (for example: "if [ blablable ]; then" or "for i in blablabla; do")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top