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: Carlo Zancanaro
Subject: Re: Unable to define shebang for guix shell file
Date: Wed, 10 Nov 2021 09:14:20 +1100
User-agent: mu4e 1.6.9; emacs 27.2

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 via email to

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