raj Posted April 21, 2006 Share Posted April 21, 2006 On linux, sh and bash are the same, but on non-linux systems this is not true. The runClient.sh script uses pushd which is a bash feature, but the script is executed under sh. So when I run runClient.sh on my FreeBSD box, it of course doesn't work because FreeBSD has a proper POSIX sh. Small gripe, but easy to fix Link to comment Share on other sites More sharing options...
ClaytoniousRex Posted April 23, 2006 Share Posted April 23, 2006 Thanks, Raj. Is it generally safe to assume that bash is present? Link to comment Share on other sites More sharing options...
raj Posted April 25, 2006 Author Share Posted April 25, 2006 It is safe to assume bash is installed iff one is running Linux. All bets are off on other systems. Generally, even on Linux systems, when bash is invoked as sh it is trying to emulate sh behavior even though bash features still seem to work. In my opinion, the pushd isn't needed. The directory the script was executed from would be restored when the subshell exits (if that is the intended function of using pushd). So, we can simply replace it with cd. The following would be more portable and, everyone can be happy: </font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">#!/bin/sh cd bin LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:../lib ./SpaceVikings exit 0</pre> Link to comment Share on other sites More sharing options...
Recommended Posts