littleIdiot
MIS
Hi,
Simple question - I'm tidying up some scripts to make them more "readable" and was trying to change the following code.
All it is meant to do is check that the user has entered valid file names and directory names when running the script from command line.
'm trying to change this:
to this:
(Open your screen up if it doesn not look neat and tidy!)
This does not work.
Any ideas on how I might make it work?
Any ideas on other, better ways of checking things like this?
Thanks,
lil'
Simple question - I'm tidying up some scripts to make them more "readable" and was trying to change the following code.
All it is meant to do is check that the user has entered valid file names and directory names when running the script from command line.
'm trying to change this:
Code:
if [ ! -f $INPUT_FILE ]
then
echo " Can not find input file."
echo " Please check and try again"
echo ""
exit
fi
if [ ! -d $TARGET ]
then
echo "Making target directory"
mkdir $TARGET
chmod 777 $TARGET
fi
if [ ! -w $TARGET ]
then
echo " Can not write to target directory."
echo " Please change permissions"
echo " Exiting ..."
echo ""
exit
fi
to this:
Code:
if [ ! -f $INPUT_FILE ] then; echo " Can not find input file. \n Please check and try again \n"; exit; fi
if [ ! -d $TARGET ] then; echo " Making target directory \n"; mkdir $TARGET; chmod 777 $TARGET;fi
if [ ! -w $TARGET ] then; echo " Can not write to target directory.\n "; exit; fi
(Open your screen up if it doesn not look neat and tidy!)
This does not work.
Any ideas on how I might make it work?
Any ideas on other, better ways of checking things like this?
Thanks,
lil'