0

I've wondered this many times and in many cases, and I like to learn so general or close-but-more needed answers are acceptable to me.

I'll get specific, to help explain the question. Please remember that this question is more about accelerating common interpreted language calls (yes, exactly the same arguments), than it is about the specific programs I'm calling in this case.

Here we go: Using i3WM I use i3lock-fancy to lock my workspace with a key-combo mapped to the command: i3lock-fancy -p -f /usr/share/fonts/fantasque_mono.ttf

So here is why I think this is possible, though my google-fu has failed me:

  • i3lock-fancy is a bash script, and bash is an interpreted language
  • each time I run the command I call it with the same arguments
    • Theoretically the interpreter is spitting out the same bitstream to be executed, right?

Please don't complain about portability, I understand it, the captured bitstream, would not be

For visual people: When I call the above command > bash interpreter converts bash-code to byte-code > CPU executes byte-code

I want to: execute command > bash interpreter converts to byte-code > save to file

so that I can effectively skip interpretation (since it's EXACTLY the same every time): call file > CPU executes byte-code

What I tried: Looking around on SO before asking the question lead me shc which is similar in some ways to what I'm asking for.

But this is not what shc is for (thanks @stefan)

is there a way to do this which is more like what I've described? Simply put, is there a way to interpret bash, and save the result without actually running it?

  • 1
    Is [bootsnap](https://github.com/Shopify/bootsnap) in the realm of what you're looking for? – anothermh Feb 15 '23 at 02:59
  • shc seems to serve a different purpose, see https://unix.stackexchange.com/questions/615419/are-compiled-shell-scripts-better-for-performance – Stefan Feb 15 '23 at 10:17
  • @Stefan Indeed, in fact reading through the answers on your link it really seems like `shc` self-invalidates by opening up its visabilty to users on the machine while only 'fake' masking the plaintext because all it did was convert to byte-code (no keys used => no encryption, sure I can't read 1s and 0s quickly... but my computer can...) – DeftconDelta Feb 15 '23 at 20:18
  • @anothermh, yes it is, thanks! I probably should have googled a bit before asking for a Ruby solution also, as I did have bash wrapped around my head at the time. – DeftconDelta Feb 15 '23 at 21:06

0 Answers0