Debian Codegraph @

utils/oscap-run-sce-script

raw symbols SCIP
1 #!/usr/bin/env bash
2 #
3 # Authors:
4 # Dominique Blaze <[email protected]>
5 #
6 # use by oscap for evaluate a SCE file when +x rights are missing
7
8 if [ ! -z $1 ] && [ -f $1 ]
9 then
10 # file exists. first check if shebang is here
11
12 firstline=$(head -n1 $1)
13 if [ ${firstline:0:2} = "#!" ]
14 then # it's a shebang
15 cmd=${firstline:2} # remove the begin (#!)
16 cmd=${cmd##*( )} # trim whitespaces
17 eval $cmd $1 > /dev/stdout
18 else # no shebang, trying bash by default ...
19 /usr/bin/env bash $1 > /dev/stdout
20 fi
21
22 else
23 echo "Script file not found: $1" > /dev/stderr
24 fi