I have a huge folder in a Linux system. Within it, I have a zip archive that encloses a couple of shell scripts. I need to execute these shell scripts, but the challenge is that I don't have write access to this folder. Also, I cannot move it to other directory either, since the location of this file is critical to its execution. It won't work in any other directory.
Is there any way to execute the shell script from within the zip archive without extracting it?
You can unzip one specific file by just specifying the path after the zip file:
In this command
a.sh
is the path to the script you want to run.You can print the contents to stdout with the
-p
parameter:And finally you can then pipe this to
sh
to run it:Note that quite a few shell scripts assume
bash
, so you may want to pipe it tobash
instead ofsh
, depending on the script.