If you need to automate something use your favorite programming language.
Ask HN: How can I get better at bash?
141–150 of 195 posts
Re: Ask HN: How can I get better at bash?
#142Set your default shell to bash, and every time something annoys you, look up how to fix it (stack overflow is basically complete at this point, if you know what to search for) and put it in your dotfiles. I used to rely on fish, but after a couple of bugs (either in fish or my fingers, not sure) I switched back to bash at my job (on a Linux desktop). After a few months I had built up a good set of aliases and functio…
Re: Ask HN: How can I get better at bash?
#143As silly as it sounds, when I was a new Unix SysAdmin, I read the entirety of "man 1 bash", which includes all bash builtins. I found that it improved by bash-foo 100x simply by knowing about so many of the utilities. I also took some cliff notes for things that seemed generally useful. I did it for an hour or so a night for a week or so. That being said, a few of my personal favorites to memorize: * Parameter expans…
Also CTRL-_ which is "undo whatever you just typed"
Re: Ask HN: How can I get better at bash?
#144Set your default shell to bash, and every time something annoys you, look up how to fix it (stack overflow is basically complete at this point, if you know what to search for) and put it in your dotfiles. I used to rely on fish, but after a couple of bugs (either in fish or my fingers, not sure) I switched back to bash at my job (on a Linux desktop). After a few months I had built up a good set of aliases and functio…
https://github.com/ggreer/the_silver_searcher
https://github.com/BurntSushi/ripgrepRe: Ask HN: How can I get better at bash?
#145 export PROMPT_COMMAND='echo "$(history 1)" >> $HOME/.basheternalhistory'
Now you can search it later for arcane commands you've forgotten how to use.Re: Ask HN: How can I get better at bash?
#146If you're not already familiar with it, I would suggest learning about the basic Unix process model -- fork, execve, wait, open, pipe, dup2 and friends. Bash is essentially a DSL for these. A lot of the weirdness you see in the language is due to these abstractions leaking through. For example: * Quoting is building execve's argv parameter. It's hard to quote correctly if you don't know what exactly you're working to…
Do you recommend a book or something like that? And preferably for a beginner?
Re: Ask HN: How can I get better at bash?
#147Re: Ask HN: How can I get better at bash?
#148Re: Ask HN: How can I get better at bash?
#149From a 14+ year Linux/Unix admin: Get a very brief reference book of every common UNIX command. Read all the commands, what they do, what options they take. Start using them. Shells are most useful when they are used to tie together other programs. In order to do this, you have to know what all the command-line tools you have at your disposal are. Learn the tools, then start writing examples using them. Keep the exam…
Without X presumably needs framebuffer or something?