help-guix
[Top][All Lists]
Advanced

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

Re: bash scripts in Guix question


From: Maxim Cournoyer
Subject: Re: bash scripts in Guix question
Date: Tue, 04 Oct 2022 23:38:57 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux)

Hi,

Olivier Dion via <help-guix@gnu.org> writes:

> On Tue, 04 Oct 2022, jordi <jordila@librebits.info> wrote:
>> Hi guixers,
>>
>> i'm wondering...for my scripts to work in Guix, instead of
>>  '#! /bin/bash' , 
>>
>
> Typically the `sh' program should be a symlinked to `bash' in your
> system profile.  I think it is the case for many distro.  If you want it
> to be bulletproof though for other distros maybe something like that:
>
> #!/bin/sh
> if [ "$(basename $SHELL)" != "bash" ]; then
>   exec bash "$0" "$@"
> fi
>
> echo "hey!"

I prefer the "#!/usr/bin/env bash" shebang; /usr/bin/env is available on
FHS distribution, and on Guix System, for convenience.  You can use if
for any interpreted script, such as Guile, Python, Perl, etc.

-- 
Thanks,
Maxim



reply via email to

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