Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15432 > unrolled thread

Re: [PATCH] docs: More hints on #! parsing

Started byStephane Chazelas <stephane.chazelas@gmail.com>
First post2019-09-25 22:36 +0100
Last post2019-09-25 22:36 +0100
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] docs: More hints on #! parsing Stephane Chazelas <stephane.chazelas@gmail.com> - 2019-09-25 22:36 +0100

#15432 — Re: [PATCH] docs: More hints on #! parsing

FromStephane Chazelas <stephane.chazelas@gmail.com>
Date2019-09-25 22:36 +0100
SubjectRe: [PATCH] docs: More hints on #! parsing
Message-ID<mailman.1109.1569447471.2190.bug-bash@gnu.org>
2019-09-25 15:33:24 -0500, Eric Blake:
[...]
>  Bash scripts often begin with @code{#! /bin/bash} (assuming that
>  Bash has been installed in @file{/bin}), since this ensures that
>  Bash will be used to interpret the script, even if it is executed
> -under another shell.
> +under another shell.  Another common practice is the use of
> +@code{#!/bin/env bash} to find the first instance of bash on @env{PATH}.
[...]

env is more commonly found in /usr/bin. There's no env in /bin
on Ubuntu or FreeBSD for instance.

Using "#! /bin/bash -" is also good practice (so your script
still works when its path starts with - or +, see also
https://unix.stackexchange.com/questions/351729/why-the-in-the-bin-sh-shebang
for more historical context).

-- 
Stephane

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web