Be efficient in your shell command trough outputs

I just read a tutorial about configuring Apache where you had to create a conf file based on your username. The tutorial reminded that you can get your username trough the whoami command. So this is the two commands you should issue.

whoami
touch username.conf

Two commands and a copy & past. Not cool as there is a far easier way. Remember that you canĀ get the result of a command while using Bash. Historically, it was trough theĀ backticks, but today, $(…) is preferred. So, rather than two lines and a copy & past, prefer this single line

touch $(whoami).conf

This way, you don’t have to worry about the username. Even better, ou can use this in a shell script.

About Darko Stankovski

Darko Stankovski is the founder and editor of Dad 3.0. You can find more about him trough the following links.

Darko Stankovski

Darko Stankovski is the founder and editor of Dad 3.0. You can find more about him trough the following links.

You may also like...

Leave a Reply