Bash script fails due to $weekday - oh HELP!

From: Phil Powell (soazine_at_erols.com)
Date: 12/30/03


Date: 30 Dec 2003 08:54:49 -0800

weekday=`date | cut -d " " -f1`

if [ $weekday='Fri' ]; then
 echo "Do you wish to retain this week's backup files (Y - yes)?"
 read retainChar
 if [ $retainChar ] && [ $retainChar='Y' ] && [ -f
/../backup/backup*.tar.gz ]; then
  # WEEKLY ARCHIVE DOUBLE-GZIPPED ARCHIVE FILE OF FILES OPTIONALLY
CREATED AT 5:01PM EVERY FRIDAY
  echo `tar zcvf "/../backup/old_backup_$fiveDaysAgo.tar.gz"
/../backup/backup*.tar.gz 2>>/../scripts/backup.err`
 fi
fi

---------------------------------------

This script should only meet the conditional if $weekday = 'Fri',
however, today, $weekday = 'Tues' and it STILL meets the conditional!
I in fact tested by manually setting $weekday to NULL and it STILL met
the conditional!

Please, if someone could just tell me what I'm doing wrong, I'm new at
bash scripting and I can't figure this one out.

Thanx
Phil



Relevant Pages

  • Re: Bash script fails due to $weekday - oh HELP!
    ... In Phil Powell wrote: ... > read retainChar ... > # WEEKLY ARCHIVE DOUBLE-GZIPPED ARCHIVE FILE OF FILES OPTIONALLY ... > bash scripting and I can't figure this one out. ...
    (comp.os.linux.misc)
  • Re: Bash script fails due to $weekday - oh HELP!
    ... In Phil Powell wrote: ... > read retainChar ... > # WEEKLY ARCHIVE DOUBLE-GZIPPED ARCHIVE FILE OF FILES OPTIONALLY ... > bash scripting and I can't figure this one out. ...
    (comp.unix.misc)
  • Bash script fails due to $weekday - oh HELP!
    ... read retainChar ... # WEEKLY ARCHIVE DOUBLE-GZIPPED ARCHIVE FILE OF FILES OPTIONALLY ... I in fact tested by manually setting $weekday to NULL and it STILL met ... bash scripting and I can't figure this one out. ...
    (comp.unix.misc)
  • Re: Bash script fails due to $weekday - oh HELP!
    ... On Tue, 30 Dec 2003 at 16:54 GMT, Phil Powell wrote: ... > read retainChar ... > # WEEKLY ARCHIVE DOUBLE-GZIPPED ARCHIVE FILE OF FILES OPTIONALLY ... single word, which succeeds as its length is non-zero. ...
    (comp.os.linux.misc)
  • Re: Bash script fails due to $weekday - oh HELP!
    ... On Tue, 30 Dec 2003 at 16:54 GMT, Phil Powell wrote: ... > read retainChar ... > # WEEKLY ARCHIVE DOUBLE-GZIPPED ARCHIVE FILE OF FILES OPTIONALLY ... single word, which succeeds as its length is non-zero. ...
    (comp.unix.misc)