Path: csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Stephane Chazelas Newsgroups: gnu.bash.bug Subject: Re: [PATCH] docs: More hints on #! parsing Date: Wed, 25 Sep 2019 22:36:41 +0100 Lines: 21 Approved: bug-bash@gnu.org Message-ID: References: <20190925203324.16276-1-eblake@redhat.com> <20190925213641.2al2rhiuh2plrffh@chaz.gmail.com> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: usenet.stanford.edu 1569447472 25622 209.51.188.17 (25 Sep 2019 21:37:52 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: Eric Blake Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=u+IAk/07BnakUYud+3ZsoIaQzxM/w7/YJG1VTplYDmU=; b=QMIcqY3jwJ26ogw93bx1Nky0a3WPi1XprDSyGRwElydY+D4cnAQCMwpB67LaoouMo5 wxJmwhHml0vrJA3p7t3BKJh/PaZhe/RQyaNqjwAT1HNxEB7mZQwlr504thFIY9TuM3/v XFPwPO8cFlhDxDKmj/maJ644/hbKy0WRhZDnFyMXLI2OXba9YAuYo2+LlMRaxsA2/xtD nCGix614e/8s58ZgBNXcdAT5oH3ETSkeqAqlRYiFMX/G04Jjw9hpsQBkLybw2w32HdXH rnxF46y4IOhu7ugwlMNC0qDN4Nl6rXq1vHoIzBZ4i2gX5jVpw37v9qhrehOVs6CLQdqT /Hxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=u+IAk/07BnakUYud+3ZsoIaQzxM/w7/YJG1VTplYDmU=; b=qv9t1Nqiy4SAxg1JRc3WqyvcCmltukA+BhhJ5/7KCSvLGH+aodfnC8r+3QMBxolPgv HPiQ4bXqThfobEHebY9tJpHePBaYOuxXY2an0fAmJ1+g/7N6GnLltllaw+RBbVZh4C3Y 4AJ5ba+8z8xAch+PmYXFwEONPxiaW3qw7WUNlMqyUz8N8M9hFQYWitZs4ztpxOOu8Lte wha74PyOhm3HYNJqx+mWzBdt2OdTaDPSLteZC2WupjkKso1NQ53/0CPDQpkAurPqBRqJ My+W3lmxfjhCLiuNaXZ8a0OXskApa2gVnvwNj5t8M60w9+bg9wMbODBrzylVj8Dj+W6a NKlA== X-Gm-Message-State: APjAAAVfKu2FgM4aQ/0wTQWS1jMQPEkhu63y1xfcX6jodRsxj3wsJGVa AY6Pdek96f0qj4E1YMxLBaA= X-Google-Smtp-Source: APXvYqxO1s94GEPsYtkvADss2eA+fkPcrA4rvBoyzjyUzK3PEuXg1iBpNEW21WIOfV/ts1S2Os0umg== X-Received: by 2002:a5d:570a:: with SMTP id a10mr294731wrv.136.1569447403201; Wed, 25 Sep 2019 14:36:43 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20190925203324.16276-1-eblake@redhat.com> User-Agent: NeoMutt/20171215 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.221.68 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <20190925213641.2al2rhiuh2plrffh@chaz.gmail.com> X-Mailman-Original-References: <20190925203324.16276-1-eblake@redhat.com> Xref: csiph.com gnu.bash.bug:15432 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