summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorSimon Tournier <zimon.toutoune@gmail.com>2023-01-27 12:12:37 +0100
committerLudovic Courtès <ludo@gnu.org>2023-03-16 12:37:03 +0100
commit5864fc33803762388264e461e002ff09e3b5e4e8 (patch)
treed8b363c6ef7593c27a615e8158c7cdbd81c07ea2 /doc
parent93918c67c5761d8f688cda5f5b49d5c49c7626d0 (diff)
downloadguix-5864fc33803762388264e461e002ff09e3b5e4e8.tar.gz
doc: Document 'shebang' for 'guix shell'.
* doc/guix.texi (Invoking guix shell): Add a note mentioning how to use
'shebang'.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'doc')
-rw-r--r--doc/guix.texi18
1 files changed, 17 insertions, 1 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 56a24a1011..aa98d7df4b 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -71,7 +71,7 @@ Copyright @copyright{} 2019 Kyle Andrews@*
 Copyright @copyright{} 2019 Alex Griffin@*
 Copyright @copyright{} 2019, 2020, 2021, 2022 Guillaume Le Vaillant@*
 Copyright @copyright{} 2020 Liliana Marie Prikler@*
-Copyright @copyright{} 2019, 2020, 2021, 2022 Simon Tournier@*
+Copyright @copyright{} 2019, 2020, 2021, 2022, 2023 Simon Tournier@*
 Copyright @copyright{} 2020 Wiktor Żelazny@*
 Copyright @copyright{} 2020 Damien Cassou@*
 Copyright @copyright{} 2020 Jakub Kądziołka@*
@@ -5939,6 +5939,22 @@ building or downloading any missing package, and runs the
 guix shell python python-numpy -- python3
 @end example
 
+@quotation Note
+@cindex shebang, for @command{guix shell}
+@command{guix shell} can be also be used as a script interpreter, also
+known as @dfn{shebang}.  Here is an example self-contained Python script
+making use of this feature:
+
+@example
+#!/usr/bin/env -S guix shell python python-numpy -- python3
+import numpy
+print("This is numpy", numpy.version.version)
+@end example
+
+You may pass any @command{guix shell} option, but there's one caveat:
+the Linux kernel has a limit of 127 bytes on shebang length.
+@end quotation
+
 Development environments can be created as in the example below, which
 spawns an interactive shell containing all the dependencies and
 environment variables needed to work on Inkscape: