Adam Jahnke changelog.com/posts

Use long flags when scripting

I peruse a fair amount of dotfile repos, and keep seeing people use short flags inside aliases and little command line tools.

Short flags are a command line shortcut, and they do belong there, but if you’re not writing the command in a prompt, do yourself (and anyone else that may someday be reading your code) a favor and be more verbose.

Because this…

curl --silent checkip.dyndns.org \
| grep --extended-regexp --only-matching '[0-9\.]+'

…is a lot easier for a human to understand than this…

curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+'

Don’t you think?

If this is your first time here - subscribe to our newsletter and follow us on Twitter.


Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00