From: Jacob Hrbek <kreyren@rixotstudio.cz>
To: Carlo Zancanaro <carlo@zancanaro.id.au>
Cc: guix-devel@gnu.org
Subject: Re: Unable to define shebang for guix shell file
Date: Tue, 09 Nov 2021 22:34:47 +0000 [thread overview]
Message-ID: <krN7QJU4ixt207c3IOl0j_74-2xvEkIhRRGF4tEVjYI1b_ok16jxzcfxkLqvNICNF_l7-qcsBt1TyopaCd8l1_T_vLDH1mbE_7UIuvYskWA=@rixotstudio.cz> (raw)
In-Reply-To: <878rxxm0ow.fsf@zancanaro.id.au>
[-- Attachment #1.1: Type: text/plain, Size: 2584 bytes --]
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 #1.2: publickey - kreyren@rixotstudio.cz - 0x1677DB82.asc --]
[-- Type: application/pgp-keys, Size: 737 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 249 bytes --]
next prev parent reply other threads:[~2021-11-09 22:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-01 0:08 Unable to define shebang for guix shell file Jacob Hrbek
2021-11-09 17:21 ` Ludovic Courtès
2021-11-09 21:35 ` Jacob Hrbek
2021-11-09 22:14 ` Carlo Zancanaro
2021-11-09 22:34 ` Jacob Hrbek [this message]
2021-11-17 10:51 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='krN7QJU4ixt207c3IOl0j_74-2xvEkIhRRGF4tEVjYI1b_ok16jxzcfxkLqvNICNF_l7-qcsBt1TyopaCd8l1_T_vLDH1mbE_7UIuvYskWA=@rixotstudio.cz' \
--to=kreyren@rixotstudio.cz \
--cc=carlo@zancanaro.id.au \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.