guix-devel
[Top][All Lists]
Advanced

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

Re: Unable to define shebang for guix shell file


From: Jacob Hrbek
Subject: Re: Unable to define shebang for guix shell file
Date: Tue, 09 Nov 2021 22:34:47 +0000

Doesn't seem to work on `busybox sh` for me (I am not aware of better way to 
replicate POSIX environment on GNU Guix):

kreyren@leonid ~$ guix shell busybox -- busybox sh
...
~ $ cat test.sh 

#!/usr/bin/env -S guix shell --
(use-modules
        (guix channels))

(list (channel
        (name 'guix)
        (url "https://git.savannah.gnu.org/git/guix.git";)
        (commit
          "f1bfd9f1948a5ff336d737c0614b9a30c2bb3097")
        (introduction
          (make-channel-introduction
            "9edb3f66fd807b096b48283debdcddccfea34bad"
            (openpgp-fingerprint
              "BBB0 2DDF 2CEA F6A8 0D1D  E643 A2A0 6DF2 A33A 54FA")))))

(specifications->manifest
        (list "emacs@27.2"
                "emacs-treemacs"
                "emacs-evil"))
~ $ ./test.sh 

guix shell: warning: no packages specified; creating an empty environment
guix shell: warning: no packages specified; creating an empty environment
~ $ cat test.sh 

#!/usr/bin/env -S 'guix shell --'
...
~ $ ./test.sh 

/usr/bin/env: ‘guix shell --’: No such file or directory
/usr/bin/env: use -[v]S to pass options in shebang lines
~ $ cat test.sh 

#!/usr/bin/env '-S guix shell --'
...
~ $ ./test.sh 

/usr/bin/env: ‘'-S guix shell --'’: No such file or directory
/usr/bin/env: use -[v]S to pass options in shebang lines

-- Jacob "Kreyren" Hrbek

Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Tuesday, November 9th, 2021 at 10:14 PM, Carlo Zancanaro 
<carlo@zancanaro.id.au> wrote:

> Hey Jacob,
> 

> On Tue, Nov 09 2021, Jacob Hrbek wrote:
> 

> > > For now I use “#!/usr/bin/env -S guix shell --”, which works
> > > 

> > > well enough for me. How does that sound? -- ludo@gnu.org
> > 

> > Not a solution as (AFIAK) POSIX only accepts one argument.
> 

> That's the point of the -S. It passes the entire rest of the line
> 

> as a single argument to /usr/bin/env, which reads it as a single
> 

> -S argument which /usr/bin/env then interprets as a command with
> 

> arguments.
> 

> Something like how this doesn't work:
> 

> $ /usr/bin/env 'echo hello'
> 

> /usr/bin/env: ‘echo hello’: No such file or directory
> 

> /usr/bin/env: use -[v]S to pass options in shebang lines
> 

> But this does:
> 

> $ /usr/bin/env '-S echo hello'
> 

> hello
> 

> It looks like this was added to coreutils in 2018 in version 8.30.
> 

> I wasn't aware of this feature until seeing Ludo's email, but it
> 

> seems like a neat solution to the problem.
> 

> Carlo

Attachment: publickey - kreyren@rixotstudio.cz - 0x1677DB82.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]