Hi,
So I am writting a script to copy files from Linux to windows using smbclient, I have done this a fair amount of times now. Unfortunately this time I am using a simply if statement to determine if the file exists before beginning the smbclient section.....however if I tab the smbclient command over the screen from the left to under the then/else commands it doesn't work - but it does if I leave it on the right of the screen.........It is annoying as I like formatted scripts...
This does not work:
if [ -f log* ]
then
echo "Files exist - transferring files" | tee -a $LOGFILE
smbclient $servername $password -U $username >> $LOGFILE << FTP
prompt
lcd $REPHOME
cd here
mkdir $DATESTAMP
cd $DATESTAMP
mput log*
exit
FTP
else
echo "Files do not exist - skipping"
fi
However this does work:
if [ -f log* ]
then
echo "Files exist - transferring files" | tee -a $LOGFILE
smbclient $servername $password -U $username >> $LOGFILE << FTP
prompt
lcd $REPHOME
cd here
mkdir $DATESTAMP
cd $DATESTAMP
mput log*
exit
FTP
else
echo "Files do not exist - skipping"
fi
I know it isn't the end of the world but I would like to look nice too