From ef66de16d5c6ecb8f3586e2d83e0e7d1d9b10c69 Mon Sep 17 00:00:00 2001 From: Ivan Zakharyaschev Date: Fri, 27 May 2016 15:19:10 +0300 Subject: [PATCH] shell.req: more idiomatic regexp for reading the shebang (use ?) Compared with a similar regexp in Emacs sources -- http://git.altlinux.org/gears/e/emacs24.git?p=emacs24.git;a=blob;f=lisp/progmodes/sh-script.el;h=4700324d376db79e27d05e5352fff2f7e841a603;hb=HEAD#l1637 : "#![ \t]?\\([^ \t\n]*/bin/env[ \t]\\)?\\([^ \t\n]+\\)" Conclusion: mostly identical meaning, with the exception of a more liberal path of env in Emacs. But ALT Sisyphus has /usr/bin/env only, so I don't see a good reason to make the regexp more general. (If a different path is written there, it won't work in ALT Sisyphus.) --- scripts/shell.req.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/shell.req.in b/scripts/shell.req.in index cc03d40..68aa5d5 100755 --- a/scripts/shell.req.in +++ b/scripts/shell.req.in @@ -23,7 +23,7 @@ print_sh_number_from_shebang() { - sed -rn -e '1 s,^\#![[:space:]]*(|/usr/bin/env[[:space:]]+)[^[:space:]]*sh([0-9]+)(|[[:space:]].*)$,\2,p' + sed -rn -e '1 s,^\#![[:space:]]*(/usr/bin/env[[:space:]]+)?[^[:space:]]*sh([0-9]+)([[:space:]].*)?$,\2,p' } shREQ= shPROV=