bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FWD: About Bash Script


From: Curtis
Subject: Re: FWD: About Bash Script
Date: Tue, 16 Feb 2010 10:52:14 -0800 (PST)
User-agent: G2/1.0

Thanks pk!

That's the same thin Greg told me.

#!/bin/bash


if [! -e b.txt];

then

mv a.txt b.txt

exit

fi



#The previous commands checks to see if b.txt is NOT already there, if
NOT, it renames a.txt to b.txt



#If the script gets here, b.txt EXISTS..........

# does_exist is a recursive function....looking at b.txt(i) ......the
first b.txt(some number) it finds NOT existing...it creates....



set i = 1

does_exist[]



if [-e b.txt.$i];
{

then

i = i +1

does_exist

else

mv a.txt b.txt.$i
exit
fi
}


I'm close but getting an eror near the last line....not really sure
why....
./test: line 25: syntax error near unexpected token `fi'
./test: line 25: `fi'



reply via email to

[Prev in Thread] Current Thread [Next in Thread]