3 ms·
What does this do mate? (I tried to run it and it failed)
by Imustaskforhelp 2y ago
What does this do mate? (I tried to run it and it failed)
- mbreese 2y agoYou’d need to pass in arguments… All it does is evaluate the expression you pass in as arguments. ./evalme.sh echo hello world The joke being that if you could transpile this evalme.sh script to a static binary, you’d effectively have a static version of bash itself (transpiled to Go).
- koolba 2y agoIt evaluates the arguments to the command as bash commands. So if you save the file as foo.sh and add it to your PATH. You could run: $ foo.sh 'date ; ls ; foo=bar ; echo "Hello $foo"' Or really anything you'd like as the argument is treated as a bash script. NOTE: The original comment had the #! of the shebang backwards (as !#) due to a typo.