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)
 
Why are you putting ";" after your "fi" ?

#!/bin/sh
j=0
i=0
for i in fdsfdsf;
do
if gfdgfdgx;
then
cbvcbg;
fi; <<---- this ; should not be here
done
i=0
if j=6;
then
for i in hjdgjyh;
do
juyirurtjyt;
done


echo &quot;jhgdjhg&quot; >/yeudhg
date >>/yeudhg;


else
if [ gfgqdfg ];
then
gfdsgfd;
fi; <<------- This ; should not be here
fi An infinite number of monkey typing at an infinite number of keyboards will eventually populate the internet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top