shebang.req: don't read the whole script

$ (echo '#!/usr/bin/perl'; cat /dev/zero) |sed -n '1s|^#![[:space:]]*/|/|p;q'
/usr/bin/perl
$
This commit is contained in:
Alexey Tourbin 2008-04-01 15:30:53 +04:00
parent b81a3b6b75
commit 47bd8eff65

View File

@ -6,7 +6,7 @@
ShebangReq()
{
local f="$1" line=; shift
line=$(sed -n '1s|^#![[:space:]]*/|/|p' "$f")
line=$(sed -n '1s|^#![[:space:]]*/|/|p;q' "$f")
[ -n "$line" ] || return 0
set -- $line
case "$#,$1" in