Learn the shell chainsaw: `xargs`. `xargs -L` vs `xargs` and `xargs -I` (examples will say use `{}` but I'm partial to `xargs -I @` because that works with Fish and Bash, plus it's a single character.
Ask HN: How do I become a shell god?
11–20 of 34 posts
Re: Ask HN: How do I become a shell god?
#12Re: Ask HN: How do I become a shell god?
#13Good starting point
Re: Ask HN: How do I become a shell god?
#14Read the whole POSIX specification for the "Shell Command Language", and in particular how input is processed by the shell through all the multiple expansion passes. https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V... From there, you have a better background for reading the documentation of shell implementations, like Bash. Also study Awk: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/a... Th…
I find Perl to be good for these things.
Re: Ask HN: How do I become a shell god?
#15https://www.oreilly.com/library/view/unix-power-tools/059600...
Re: Ask HN: How do I become a shell god?
#16Re: Ask HN: How do I become a shell god?
#17Re: Ask HN: How do I become a shell god?
#18I’d recommend the Advanced Bash Scripting Guide https://tldp.org/LDP/abs/html/ and make peace with the fact that you’ll never know it all and enjoy the journey. Years later you’ll still be stumbling across new stuff.
Re: Ask HN: How do I become a shell god?
#19If you encounter a problem or task, then do it using shell commands. This will push into asking the question "what command can do X?" and "how do I connect command X to command Y?" and "how do loop commands over output?". Then just keep doing that over and over again. Learn the shell chainsaw: `xargs`. `xargs -L` vs `xargs` and `xargs -I` (examples will say use `{}` but I'm partial to `xargs -I @` because that works…
Re: Ask HN: How do I become a shell god?
#20My way is: Try to write small loops and pipes on the command line. I do things like this all the time: for i in foo*.txt; do mv $i OLD-$i; done You'll find this breaks sometimes, so use control-r to recall the command and fix it for i in foo*.txt; do mv "$i" "OLD-$i"; done if it gets too long, copy/paste it into a file like ~/bin/renamer and multiple lines and indenting and make it a more permanent part of your colle…