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.)
This commit is contained in:
Ivan Zakharyaschev 2016-05-27 15:19:10 +03:00
parent 06f844cd6f
commit ef66de16d5

View File

@ -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=