This works of course. I can run
./test1.sh cats and the argument
cats is passed correctly to
$ cat test1.sh #!/bin/sh ls -l $1
Can you tell me how do I make this second example — the same content as the first one, but encrypted — work the same way? The password is "password".
openssl outputs the above script, and
ls -l runs, but how do I pass the command line argument to it?
$ cat test2.sh #!/bin/sh echo "U2FsdGVkX1/m01Eg0CvZ7DiBi5Nf81+JrCWfKIDI9WtbkTZIVLhZskkKIioVfbSe"|openssl enc -base64 -d -aes-256-cbc|sh $1
test2.sh is equivalent to
$ cat test3.sh #!/bin/sh printf '%s\n' '#!/bin/sh' 'ls -l $1' | sh $1