liberize / ssc

Convert shell script to binary
GNU General Public License v3.0
66 stars 21 forks source link

Error when the target script is not in the same directory #6

Closed levisre closed 9 months ago

levisre commented 9 months ago

When I was trying to convert a file in another directory, It threw an error in Perl Regex:

Used command:

 ./ssc -u -s ~/exec.sh mains -v

Result:

+ CXXFLAGS=' -DUNTRACEABLE -static -static-libgcc -static-libstdc++ -v'
+ shift
+ '[' -n '' ']'
+ eval set -- '"/home/oem/exec.sh"' '"mains"'
++ set -- /home/oem/exec.sh mains
+ '[' -n '' -o 2 '!=' 2 ']'
++ dirname ./ssc
+ DIR=.
+ perl -pe 's/SCRIPT_FILE_NAME//home/oem/exec.sh/g; s/SCRIPT_CONTENT/`cat '\''/home/oem/exec.sh'\''`/ge' ./main.cpp
Unknown regexp modifier "/h" at -e line 1, at end of line
Unknown regexp modifier "/h" at -e line 1, near "; "
Can't find string terminator "`" anywhere before EOF at -e line 1.
+ exit 1

Maybe need to escape \ character?

levisre commented 9 months ago

I've submitted a PR: #7 to address this issue.