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

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -