aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcppawk7
1 files changed, 5 insertions, 2 deletions
diff --git a/cppawk b/cppawk
index cdff59e..7911908 100755
--- a/cppawk
+++ b/cppawk
@@ -37,6 +37,7 @@ awk_file=
awk_opts=
prepro_opts=
tmp_file=
+delhashbang="sed -e /^#!/d"
# functions
shell_escape()
@@ -107,11 +108,13 @@ trap 'rm -f $tmp_file' EXIT INT TERM
if [ -n "$awk_file" ] ; then
tmp_file=$(mktemp)
- $prepro $prepro_opts "$awk_file" > $tmp_file
+ $delhashbang "$awk_file" | $prepro $prepro_opts - > $tmp_file
$awk $awk_opts -f $tmp_file "$@"
elif [ $# -gt 0 ] ; then
tmp_file=$(mktemp)
- printf "%s" "$1" | $prepro $incopt"$(pwd)" $prepro_opts - > $tmp_file; shift
+ printf "%s" "$1" | $delhashbang | \
+ $prepro $incopt"$(pwd)" $prepro_opts - > $tmp_file
+ shift
$awk $awk_opts -f $tmp_file "$@"
else
die "awk code must be specified"