Posts with the tag « bash » :

🔗 Easy way to create -h help messages for shell scripts

-

Have you ever thought how good it would be to have a help message for your shell script that you wrote a month ago and already forgot what it is supposed to do?

Yeah, there is always a way to show a message using cat (meow) or a bunch of echo calls.

But there is a neat trick.

Add your message with all the required information on top of your file, just right after the shebang. <<<

🔗 Bash Brackets Quick Reference | assert_not magic?

-

Bash has lots of different kinds of brackets. Like, many much lots. It adds meaning to doubling up different brackets, and a dollar sign in front means something even more different. And, the brackets are used differently than many other languages. I constantly find myself doing a 5-second search for which one is the right one to do since I’m not writing Bash scripts all the time. So here, I’m going to lay them all out and then print this article out and staple it to the wall by my desk. Possibly with a decorative frame. So here we go.