Can you "pipe" these Posix-Shell functions together? I read somewhere that Bash-shell functions can be?
Pure Sh Bible
41–50 of 138 posts
Re: Pure Sh Bible
#42Earlier quoted context omitted.
Try the Windows version on frippery.org. I see it in the screen capture. https://frippery.org/busybox/index.html
There's an option to install the "bash" applet as a link to either ash or hush, the two shells that busybox comes with. Turns out that a large number of "bash scripts" use no bash-specific features in spite of using "bash" in the #!, or only a few bash-specific features like [[ ]]. It's disabled by default, and arguably not a good idea to enable it because compatibility is not great as you found out. Either way, "bus…
${var//findpattern/replace}
It turns out that busybox equates [[ to [ in the source, sidestepping the differences.Re: Pure Sh Bible
#43Earlier quoted context omitted.
As far as I can tell, there is no busybox bash. busybox's built-in shell is ash. There are options to enable a few bash-compatible extensions, but there is no "bash" applet.
Try the Windows version on frippery.org. I see it in the screen capture. https://frippery.org/busybox/index.html
Re: Pure Sh Bible
#44Mildly annoyed when people constantly refer to their article as the Bible of X. For those of us who are religious, it is in poor taste.
Re: Pure Sh Bible
#45I think all such shell "magic" should come with a huge disclaimer pointing the user at better alternatives such as perl or python. And all snippets should have the necessary caveats on horribly broken and dangerous stuff such as "if this variable contains anything other than letters, your 'eval' will summon demons" in eval "hello_$var=value" and stuff...
Re: Pure Sh Bible
#46Earlier quoted context omitted.
Try the Windows version on frippery.org. I see it in the screen capture. https://frippery.org/busybox/index.html
that bash you see is actually a symlink to ash
I'm confident that it is presented. I use this to spray SQL to dozens of databases.
Re: Pure Sh Bible
#47Earlier quoted context omitted.
I like busybox bash (especially on Windows) which is very much not bash. Busybox bash does not implement arrays, for starters, which is a deal breaker for many scripts. The Windows kernel forks processes about 10x slower than Linux, so these tricks have real performance value for POSIX-family shells running there.
You can implement arrays for POSIX shell in POSIX shell by changing the input separator to new line, and writing some simple helper functions to search for it. It’s not the prettiest solution but works for many use cases of arrays in shell scripts.
Re: Pure Sh Bible
#48If you are at this level of required complexity as in those examples, you should use a proper programming language, not shell. Half those snippets fail with spaces in the wrong place, newlines, control characters, etc. I think all such shell "magic" should come with a huge disclaimer pointing the user at better alternatives such as perl or python. And all snippets should have the necessary caveats on horribly broken…
I should really just start with Python, but old habits and all that.
Re: Pure Sh Bible
#49A lot of things i would either do manually because i had forgotten shell programming, or i would have done in a seperate pyenv with 2-3 packages i can get done in about 4 minutes.
Re: Pure Sh Bible
#50i dont know about anyone else. but since ChatGPT, my shell game is probably the one that is most levelled up. A lot of things i would either do manually because i had forgotten shell programming, or i would have done in a seperate pyenv with 2-3 packages i can get done in about 4 minutes.