I am a beginner at programming in Unix enviroment and I am facing some difficulties at start. I am using PUTTY on Windows. Here is my script and the code but when I run it, it tells me that
integer expression expected
#!/bin/bash
hour='date|cut-c12-13'
if [ $hour -ge 0 -a $hour -lt 12 ]; then
echo "good morn"
elif [ $hour -lt 18 ]; then
echo "good afternoon"
else
echo "good night"
fi
It seems that it doesn't work correctly with the pipeline or something; it doesn't translate the 'date' to the original date but takes it as a word, I think.