Bash - Determine if I should 'work', 'play' or 'sleep'

should_i_work(){ current_hour=$(date "+%H"); if [ $current_hour -ge '08' ]; then if [ $current_hour -le '17' ]; then echo 'work'; else echo 'play'; fi else echo 'sleep'; fi; }; should_i_work;

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.