Haha, I did exactly this, minus the coloring for a presentation to a client. I only had an SSH access to my machine and was demoing CLI tools, so was too lazy to change context (and was able to have the slides stay into a corner of the screen with the tool taking the other side).
Without much formatting, the script itself is very short, it was fun. Not sure the client was impressed however! But the presentation went well (at least the product was exceeding expectations).
I’m not sure there are many reasons to do it in bash instead of POSIX shell however? Only thing lacking might be local variables in functions, but many shell still implement them.
Interesting! I’m planning to use this in a talk I’m giving this weekend. Let’s see how that goes. :D
I’m not sure there are many reasons to do it in bash instead of POSIX shell however?
I use bash interactively and am fairly comfortable with its features; mapfile etc. are pretty nifty. Shouldn’t be too hard to port it to POSIX sh though—I just might.
In the immortal words of Dr. Ian Malcolm, “Your scientists were so preoccupied with whether or not they could, they didn’t stop to think if they should.”
This turned out nice. I might send a PR or two your way to . :-)
It shouldn’t be difficult at all to port this to POSIX shell too.
Haha, I did exactly this, minus the coloring for a presentation to a client. I only had an SSH access to my machine and was demoing CLI tools, so was too lazy to change context (and was able to have the slides stay into a corner of the screen with the tool taking the other side).
Without much formatting, the script itself is very short, it was fun. Not sure the client was impressed however! But the presentation went well (at least the product was exceeding expectations).
I’m not sure there are many reasons to do it in bash instead of POSIX shell however? Only thing lacking might be local variables in functions, but many shell still implement them.
Local variables (or more specifically the ‘local’ keyword) can be mimicked in POSIX shell by wrapping the code in
( )
with the expense of a sub-shell.Example:
I also sometimes do this with functions themselves.
(Notice how ‘()’ is used in place of ‘{}’ for the function body).
Interesting! I’m planning to use this in a talk I’m giving this weekend. Let’s see how that goes. :D
I use bash interactively and am fairly comfortable with its features;
mapfile
etc. are pretty nifty. Shouldn’t be too hard to port it to POSIX sh though—I just might.In the immortal words of Dr. Ian Malcolm, “Your scientists were so preoccupied with whether or not they could, they didn’t stop to think if they should.”
You may want to consider envsubst. proably better fits the model you’re trying to achieve with this line anyhow.
This is SO cool!