Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trying to create a simple script using KORN SHELL 2

Status
Not open for further replies.

kim808

IS-IT--Management
Nov 12, 2002
2
US
I'm trying to create a script in KORN shell which sends a not to remind you that it is friday the 13th. I need to use the banner command to display the date and the message
"beware it's friday the 13th" I could really use some help. so far i got:

#!/bin/ksh
set 'date'
if[[ $1 -eq "Fri" && $3 -eq "13" ]] then
banner date "beware its friday the 13th"
fi

however i seem to have errors with the syntax of [[ $1 -eq "Fri" && $3 -eq "13" ]] and i cant get the banner command to display the date
 
if[ $1 -eq "Fri" -a $3 -eq "13" ]; then
banner date `date +"%d/%m/%y"` "beware its friday the 13th"
fi

Though I prefer the cron method in your previous thread,
thread822-404200 , to check the date .
HTH ;-) Dickie Bird
Honi soit qui mal y pense
 
Try this:

#!/bin/ksh

Day=$(date | awk '{print $1}')
Date=$(date | awk '{print $3}')
PrintDate="$Day $Date"
if [[ $Day = "Fri" && $Date = "13" ]]; then
print "$PrintDate Beware its the 13th"
fi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top