| 1 | #!/usr/bin/envscip-shell filesystem . . `/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 [scip-shell system . . `[`. ! -z $1 ] && [scip-shell system . . `[`. -f $1 ] |
| 9 | then |
| 10 | # file exists. first check if shebang is here |
| 11 | |
| 12 | firstline=$(headscip-shell system . . head. -n1 $1) |
| 13 | if [scip-shell system . . `[`. ${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/stdoutscip-shell filesystem . . `/dev/stdout`. |
| 18 | else # no shebang, trying bash by default ... |
| 19 | /usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash $1 > /dev/stdoutscip-shell filesystem . . `/dev/stdout`. |
| 20 | fi |
| 21 | |
| 22 | else |
| 23 | echoscip-shell system . . echo. "Script file not found: $1" > /dev/stderrscip-shell filesystem . . `/dev/stderr`. |
| 24 | fi |