Task
Make code given on the command line that takes an unpacked hex value as input and eval
s that in Perl. Like this:
perl -e 'map{eval}pack q/h*/,q/072796e6470222458656275672370202d6f62756020222b302072796e6470222478616e60202f6e6560202771697020247f6020246f602029647e2c5e622/'
But with one additional restriction: Your code must survive any level of ssh
(and the example above does not survive because the space would need to be quoted:
# This does not work
ssh server perl -e 'map{eval}pack q/h*/,q/072796e6470222458656275672370202d6f62756020222b302072796e6470222478616e60202f6e6560202771697020247f6020246f602029647e2c5e622/'
# This would survive 1 level of ssh but not 2
ssh server perl -e 'map{eval}pack\ q/h*/,q/072796e6470222458656275672370202d6f62756020222b302072796e6470222478616e60202f6e6560202771697020247f6020246f602029647e2c5e622/'
)
So:
ssh server your_code hexvalue
ssh server ssh server2 your_code hexvalue
ssh server ssh server2 ssh server3 your_code hexvalue
should all give the same result. You will not be told the number of levels of ssh
.
You can assume the login shell is bash.
You can choose to include the hex value in the program (in which case it obviously does not count towards the length of your code) or have it given as an argument to your program.
You are also allowed to preprocess the hex value (e.g. convert it to another format) and use that value instead. But you cannot do the eval
locally: It must be run on the remote server. The preprocessing code is of course also code thus also part of the byte count.
Test
Given the value:
072796e6470222458656275672370202d6f62756020222b302072796e6470222478616e60202f6e6560202771697020247f6020246f602029647e2c5e622
your program should print:
There's more than one way to do it.
And:
4216d3223616d656c622b302072796e6470222140242160296e6024786560246563737562747e2c5e622
should print:
A camel in the dessert.
Finally:
072796e647020686f63747e616d65606
should print the hostname of the server that you ssh
to.
Scoring
Code that only uses Perl wins over code that uses Bash+Perl which wins over code in any other languages.
In case of a tie: Code without warnings wins.
In case of a tie: Shortest code wins.
Edit
Clarified preprocessing is allowed, but not for free, and warnings are frowned upon, but not illegal.
eval+v
in ais523’s answer is just as much a part of the preprocessed format as the.
s), leading to a score of 0 bytes. \$\endgroup\$