unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Carlo Zancanaro <carlo@zancanaro.id.au>
To: Jacob Hrbek <kreyren@rixotstudio.cz>
Cc: guix-devel@gnu.org
Subject: Re: Unable to define shebang for guix shell file
Date: Wed, 10 Nov 2021 09:14:20 +1100	[thread overview]
Message-ID: <878rxxm0ow.fsf@zancanaro.id.au> (raw)
In-Reply-To: <YsoKjRpppoP7mNFuU0pok0mhlWKs_cHLxuJTHsOSm6BARdADcgpVM34qFnwY5NcuZje0RNwD2QlELoCjPWpPZv0dzMV0j7sL9W7CVqrdhkA=@rixotstudio.cz>

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


  reply	other threads:[~2021-11-09 22:20 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 [this message]
2021-11-09 22:34       ` Jacob Hrbek
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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878rxxm0ow.fsf@zancanaro.id.au \
    --to=carlo@zancanaro.id.au \
    --cc=guix-devel@gnu.org \
    --cc=kreyren@rixotstudio.cz \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).