journal@aboutdavid

Thoughts and feelings that come from my brain and into a linux shell.

programming in bash is great

March 12, 2021 — aboutdavid

I started programming CLI tools/applications in bash yesterday. Normally, I make small bash scripts to help run files. I actually kind of like it over Node.js. Instead of using the (annoying) HTTP module or the node-fetch package, I can do something like this:

bash HTML=$(curl https://example.com) echo HTML

Bash can be a bit annoying to learn, for example, date formatting. I’ve never used the date command before, so instead of typing:

js new Date(); // Tue Mar 09 2021 12:21:59 GMT-0500 (Eastern Standard Time)

You need to run

date +"%B %d, %Y (%r)" Which outputs:

March 09, 2021 (12:21:03 PM)

Yeah I know, “big deal buddy” but seriously, It can be annoying.

Althogh, I do like the fact that I don’t need something like moment.js to format dates

I also like the fact that I don’t need to require a package like readline or inquirer to get user input:

bash echo "Yo! What's your name?" READ name echo "Welcome $name!"

Well, thanks for reading, bye!

welcome

March 09, 2021 — ~aboutdavid

Welcome! This is my journal, where I keep thoughts here using BashBlog