Quote:
Originally Posted by michaelk
Hint:
time='date | awk {'print $4}'
Will assign time to the 4th variable and looking at the ouput of the date command would be time.
You can use string commands to seperate out hours and minutes.
|
I have changed the script, but still I got the same error message.
#!/bin/bash
/bin/date
hour='date | awk {'print $4'}'
min='date | awk {'print $5'}'
day='date |awk {'print [cal (Mon - Fri)]'}'
while true;
do
if [$HOUR -eq 8] -a [$MIN -eq 15]; then
print -v $DAY "Good Morning"
else
sleep 13500s
fi
done
Error message:
day: line 3: }: command not found
day: line 4: }: command not found
day: line 5: syntax error near unexpected token `('
day: line 5: `day='date |awk {'print [cal (Mon - Fri)]'}'