Bash script fails due to $weekday - oh HELP!
From: Phil Powell (soazine_at_erols.com)
Date: 12/30/03
- Next message: Davide Bianchi: "Re: Bash script fails due to $weekday - oh HELP!"
- Previous message: Shuqing Wu: "Re: malloc blocks"
- Next in thread: Davide Bianchi: "Re: Bash script fails due to $weekday - oh HELP!"
- Reply: Davide Bianchi: "Re: Bash script fails due to $weekday - oh HELP!"
- Reply: Dragan Cvetkovic: "Re: Bash script fails due to $weekday - oh HELP!"
- Reply: Chris F.A. Johnson: "Re: Bash script fails due to $weekday - oh HELP!"
- Reply: William Park: "Re: Bash script fails due to $weekday - oh HELP!"
- Reply: Noi: "Re: Bash script fails due to $weekday - oh HELP!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Davide Bianchi: "Re: Bash script fails due to $weekday - oh HELP!"
- Previous message: Shuqing Wu: "Re: malloc blocks"
- Next in thread: Davide Bianchi: "Re: Bash script fails due to $weekday - oh HELP!"
- Reply: Davide Bianchi: "Re: Bash script fails due to $weekday - oh HELP!"
- Reply: Dragan Cvetkovic: "Re: Bash script fails due to $weekday - oh HELP!"
- Reply: Chris F.A. Johnson: "Re: Bash script fails due to $weekday - oh HELP!"
- Reply: William Park: "Re: Bash script fails due to $weekday - oh HELP!"
- Reply: Noi: "Re: Bash script fails due to $weekday - oh HELP!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|