Linux : Shell scripting to known whether it is evening or morning -
my code giving error . think there error in line 1.
x=$((date+"%h")) printf "%d\n" $x if [ $x -le 12 ] printf "good morning\n" elif [ $x -le 16 ] printf "good afternoon\n" else printf "good evening\n" fi thanks
$(( )) evaluates mathematical expressions, , date +"%h" not maths expression. think may confusing x=$(date +"%h"), "assign output of date +"%h" x.
Comments
Post a Comment