delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/01/31/13:28:29

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <3A785421.CDC4E017@veritas.com>
Date: Wed, 31 Jan 2001 10:06:25 -0800
From: Bob McGowan <rmcgowan AT veritas DOT com>
Organization: VERITAS Software
X-Mailer: Mozilla 4.73 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
To: Josifovski Ljubomir-BLJ01Z <BLJ01Z AT motorola DOT com>
CC: "Cygwin Mailing List (E-mail)" <cygwin AT sourceware DOT cygnus DOT com>
Subject: Re: [OT] #!/usr/bin/env bash -vx
References: <D1F0002F0A8FD411ACEC00805FE675CE260F22 AT zuk02exm02 DOT comm DOT mot DOT com>

I just tried this on a Solaris 2.7 system.  The form using '#!/usr/bin/env bash -vx'  doesn't work there either.  It just ignores the "extra" (3rd) field.  This most likely
has to do with slightly different ways of handling the "#!".  I think you'll need to stick with the minimal form (#!/path/cmd arg) for portability.

Since the -vx in my experience is used for debugging, I'd suggest either adding the line "set -vx" after the first line of the script or starting the script using bash
explicitly (bash -vx script).  Note that using the 'set' command in the script eliminates output from shell processing of .bashrc and the environment, while the second
includes it.

If you have other questions/comments, we can take this offline, since, as you note it is OT for this list.

Cheers,

Bob

Josifovski Ljubomir-BLJ01Z wrote:
> 
> This is not exclusive to cygwin, but maybe someone here can help me. I put
> 
> #!/usr/bin/env bash
> 
> in the first line on some scripts I use on Cygwin, Linux and HP-UX because
> the exact path to bash differs (someone posted this trick on the list
> sometime ago). But when arguments are added to the line, like
> 
> #!/usr/bin/env bash -vx
> 
> this doesn't work anymore - I get:
> 
> $ cat qwe
> #!/usr/bin/env bash -vx
> 
> echo qqqqqqqqqqqqqqqqqqqqqqqqqqqq
> 
> $ ls -l qwe
> -rwxr-xr-x   1 ljupco   None           59 Jan 31 16:06 qwe
> 
> $ qwe
> /usr/bin/env: bash -vx: No such file or directory
> 
> Wheras the direct path works:
> 
> $ cat qwe
> #!/usr/bin/bash -vx
> 
> echo qqqqqqqqqqqqqqqqqqqqqqqqqqqq
> 
> $ ./qwe
> #!/usr/bin/bash -vx
> 
> echo qqqqqqqqqqqqqqqqqqqqqqqqqqqq
> + echo qqqqqqqqqqqqqqqqqqqqqqqqqqqq
> qqqqqqqqqqqqqqqqqqqqqqqqqqqq
> 
> thanks,
> 
> --
> Ljubomir Josifovski
> mailto:L DOT Josifovski AT dcs DOT shef DOT ac DOT uk,blj01z AT motorola DOT com
> http://www.dcs.shef.ac.uk/~ljupco
> 
> --
> Want to unsubscribe from this list?
> Check out: http://cygwin.com/ml/#unsubscribe-simple

-- 
Bob McGowan
Staff Software Quality Engineer
VERITAS Software
rmcgowan AT veritas DOT com

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019