The same with a bit of rearranging: read -p "Give me a file name! I will append a date to it. " filename if [ ! -f "$filename" ] ; then echo "The file you specified is invalid." elif date 2> /dev/null >> "$filename" ; then echo "$filename was written successfully." else echo "$filename could not be written." fi
Regards, - Robert 2009/5/30 Jeremiah Bess <[email protected]>: > You need a space between the [ and -f and also on the -w. > > Jeremiah E. Bess > Network Ninja, Penguin Geek, Father of four > > > On Sat, May 30, 2009 at 15:22, Ryein <[email protected]> wrote: >> >> not to high jack this thing, but can anyone tell me whats wrong with this >> script >> >> echo -n "Give me a file name! I will append a date to it. " >> read filename >> date >> $filename >> >> if [-f $filename ] >> then >> if [-w $filename ] >> then >> date >> $filename >> echo "$filename was written successfully." >> else >> echo "$filename could not be written." >> fi >> else >> echo "The file you specified is invalid." >> fi >> >> > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Linux Users Group. To post a message, send email to [email protected] To unsubscribe, send email to [email protected] For more options, visit our group at http://groups.google.com/group/linuxusersgroup -~----------~----~----~----~------~----~------~--~---
