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 07:57:07 -0800 (PST)
User-agent: G2/1.0

Here's what I have but i'm getting some errors

#!/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.$1);

then

i = i +1

does_exist

else

mv a.txt b.txt.$i

exit

fi

}


reply via email to

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