running a simple command line tool

Avi Greenbury lists at avi.co
Thu Feb 23 11:40:43 UTC 2012


CJ Tres wrote:

> Running basic smoketest.
> smoketest.sh: 12: [[: not found
> smoketest.sh: 18: [[: not found
> smoketest.sh: 26: function: not found
> Error found.  Leaving run.11199 in place.
> Unable to execute command: 'sh test.sh'

This looks like it's down to a naughty developer :)

[[ is a 'bashism' (so-called because it's something that exists in
bash but not in the 'sh' that it's a development from).

The command 'sh test.sh' passes the 'test.sh' script to 'sh' which is
a shell. Normally and historically it's a link to /bin/bash but
modern Ubuntus and Debians use dash instead (in the interests of
speed). [[ doesn't work in dash, so the test script fails on that error
and the install aborts.

It should be a simple fix - the invocation of that script should be

bash test.sh

rather than

sh test.sh

> So... a question.
>  From my obvious lack of knowledge, would an understanding of bash 
> scripting help shed some light on my darkness in this case, or is it 
> perl I would need to better understand?

Of scripting, bash would be more helpful here. Perhaps most useful
would be experience installing Perl apps, but that's rather niche :)

Really, this is less bash scripting and more simply using bash, but the
easiest way to use bash is to automate it into scripts. 

-- 
Avi




More information about the ubuntu-users mailing list