[Top][All Lists]

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

[gnuastro-commits] master 7259736: Book: added paragraph on env-based sh

From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 7259736: Book: added paragraph on env-based shebang in tutorial on scripts
Date: Sun, 22 Nov 2020 12:09:01 -0500 (EST)

branch: master
commit 72597369acbca60b46c32fe5fe7a4f7e803a5051
Author: Mohammad Akhlaghi <>
Commit: Mohammad Akhlaghi <>

    Book: added paragraph on env-based shebang in tutorial on scripts
    Until now, in the toturial on shell scripting, we had only mentioned the
    '#!/bin/bash' shebang. But it is also common to use '#!/usr/bin/env bash'
    to use the first Bash in PATH.
    With this commit, to help new users also get familiar with the env-based
    shebangs, a paragraph is added that describes the situations it can be
    useful. It concludes with an explanation that for simplicity we'll continue
    with the direct bash call here.
    This was suggested by Carlos Morales Socorro.
 THANKS                       | 1 +
 doc/announce-acknowledge.txt | 1 +
 doc/gnuastro.texi            | 6 ++++++
 3 files changed, 8 insertions(+)

diff --git a/THANKS b/THANKS
index 59eac9b..d4eec25 100644
--- a/THANKS
+++ b/THANKS
@@ -72,6 +72,7 @@ support in Gnuastro. The list is ordered alphabetically (by 
family name).
     Joseph Putko               
     Samane Raji                
     Francois Ochsenbein        
+    Carlos Morales Socorro     
     Teymoor Saifollahi         
     Joanna Sakowska            
     Elham Saremi               
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index 225028d..6418f06 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -4,6 +4,7 @@ Martin Kuemmel
 Sebastian Luna Valero
 Samane Raji
 Francois Ochsenbein
+Carlos Morales Socorro
 Joanna Sakowska
 Zahra Sharbaf
 Sachin Kumar Singh
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 62cb9d2..2bf3f22 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -3614,6 +3614,12 @@ So the first line of your script should be 
 When the script is to be run by the same shell that is calling it (like this 
script), the shebang is optional.
 But it is still recommended, because it ensures that even if the user isn't 
using GNU Bash, the script will be run in GNU Bash: given the differences 
between various shells, writing truely portable shell scripts, that can be run 
by many shell programs/implementations, isn't easy (sometimes not possible!).}.
+It may happen (rarely) that GNU Bash is in another location on your system.
+In other cases, you may prefer to use a non-standard version of Bash installed 
in another location (that has higher priority in your @code{PATH}, see 
@ref{Installation directory}).
+In such cases, you can use the `@code{#!/usr/bin/env bash}' shebang instead.
+Through the @code{env} program, this shebang will look in your @code{PATH} and 
use the first @command{bash} it finds to run your script.
+But for simplicity in the rest of the tutorial, we'll continue with the 
`@code{#!/bin/bash}' shebang.
 Using your favorite text editor, make a new empty file, let's call it 
 Write the GNU Bash shebang (above) as its first line
 After the shebang, copy the series of commands we ran above.

reply via email to

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