[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Script doesn't work when it is run using '#!/bin/sh'



On Sat 16 Apr 2016 at 15:08:58 (+0200), tomas@tuxteam.de wrote:
> On Sat, Apr 16, 2016 at 01:22:09PM +0100, Aero Maxx wrote:
> > I have a number of bash scripts that work perfectly fine on fedora
> > 23, but do not work on debian 8.  I've tried to sort it out myself,
> > but am a little stuck now hopefully someone is able to give me a
> > nudge in the right direction.
> 
> > The output I get from the above script is
> > >wordpress_beta.sh: 8: bashtest.sh: [[: not found
> > >wordpress_beta.sh: 8: bashtest.sh: web: not found
> > >wordpress_beta.sh: 8: bashtest.sh: web: not found
> > >
> > >Setting current directory to 'web' web public folder.
> 
> The [[ is correct bash syntax. To try to pinpoint the problem, try
> running the script with "bash <script>". If you don't want to run
> the script but just to check syntax, you might want to try
> "bash -n <script>".
> 
> If that works out OK, perhaps your script is still being invoked
> under dash?

Yes, I would expect "line 8:" from bash, not just "8:", and one
filename, not two. OTOH dash does print two filenames.
Also
$ man bash | grep '\[\[' | wc
     14     183    1318
$ man dash | grep '\[\[' | wc
      0       0       0
$ man bash | grep '==' | wc
      6      83     498
$ man dash | grep '==' | wc
      0       0       0
$ 

Cheers,
David.


Reply to: