Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

the script:

waktu=$(date +"%H")

if (( $waktu >= 5 && $waktu <= 10 ))
elif (( $waktu >= 10 && $waktu <= 3 ))
elif (( $waktu >= 4 && $waktu <= 7 ))

echo “Selamat $salam $kelompok dengan user $USER, sekarang pukul $waktu dan pada direktori $dir_skrg”

it gives error: 5: 14: not found 8: 14: not found 11: 14: not found

but not in my friend ubuntu's. andybody knows why?

14 is the hour when I run the script, I assume for some reason it thinks 14 is a file

share|improve this question
is this the whole file? It's obviously complaining about lines 5,8, and 11. Just wanted to make sure those are the actual lines. – Nate Sep 20 '12 at 14:16
yeah it is the whole file – Haidar M. Sep 20 '12 at 14:22
up vote 5 down vote accepted

Looks like that is being run as a shell (sh) script rather than bash script. Try to run it like this:


or enter the following as the first line of your script


Then run as ./

share|improve this answer
ah yeah silly mistakes after all. I thought it is the same. Thanks :D – Haidar M. Sep 20 '12 at 14:30
For many practical purposes, it is the same. However, bash is way richer than sh alone; for example, in sh, you would write `command` rather than $(command), or if [ $n1 -gt $n2 ] ; then rather than if (( $n1 > $n2 )) ; then. – January Sep 20 '12 at 16:44

Add #!/bin/bash to the top of your script, as the first line.

Note: This is called a shebang. More information about it may be found here.

Give your script the correct permissions.

chmod a+x <script_name>

Run your script again.

share|improve this answer
thanks for the suggestion, but my script still don't works – Haidar M. Sep 20 '12 at 14:25
@HaidarM. Then edit your question to give the exact errors you encounter, if they've changed. – SirCharlo Sep 20 '12 at 14:26
it works actually, sorry, my mistakes :D – Haidar M. Sep 20 '12 at 14:32
@HaidarM. Great! Please consider upvoting all the useful answers. This encourages people to help you in the future. Thank you! :) – SirCharlo Sep 20 '12 at 14:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.