Timestamp copying giving file path and name as inputs

PLAESE CHECK WHETHER THIS SCRIPT WORKS OR NOT.
THIS IS MY FIRST SCRIPT, HELP ME out if any ERRORS are present.

a=0;
while [$a -eq 0] 
do 

echo "ENTER path"
read path
if [ -e $path ] then
echo "path found"
cd $path

DateTimeStamp=$(date '+%d_%m_%y_%H_%M')
echo "enter file name"
read file
if [-e $file] then
echo "file exists"
cp ${path}/${file} ${path}/${file}_bkp_${DateTimeStamp}
echo "file backup created using file name ${path}/${file}_bkp_${DateTimeStamp}"

chmod 755 ${path}/${file}_bkp_${DateTimeStamp} 
else
echo "file doesnot exist"
a=1;
fi
else
echo "path does not exist"
a=1;
fi
done
  1. Please use code tags for code.
  2. Indent your code so it is readable.

I have indented and used the so that it is nicely coloured:
a=0;
while [ $a -eq 0 ] # Needs SPACE there
do
echo "ENTER path"
read path
if [ -e $path ]; then # You forgot a ';' here
echo "path found"
cd $path
DateTimeStamp=$(date '+%d_%m_%y_%H_%M')
echo "enter file name"
read file
if [ -e $file ]; then # here too ! and needs SPACE
echo "file exists"
cp ${path}/${file} ${path}/${file}_bkp_${DateTimeStamp}
echo "file backup created using file name
${path}/${file}_bkp_${DateTimeStamp}"
chmod 755 ${path}/${file}_bkp_${DateTimeStamp}
else
echo "file does not exist"
a=1 # no need of ';' here
fi
else
echo "path does not exist"
a=1 # no need of ';' here
fi
done

Thanks frans :slight_smile: :slight_smile: .... and thanks for explaining my mistakes :slight_smile: