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 }