DEV Community

Getting started with bash

Damien Cosset on June 24, 2019

Introduction What the hell is bash anyway? Before doing any kind of research, I actually had a very difficult coming up with a simple ex...
Collapse
 
polyluxus profile image
Martin Schwarzer

You can use $USER instead of invoking another program, i.e. $(whoami). Similarly for $PWD. You can also use printf directly to print the date, check man strftime.

The printf command is really powerful and is more than an extension to echo. Note that the way you are using it may cause issues, as it concatenates the format and the variable(s) part:

printf 'FORMAT' $VALUE(S)

Or as an example:

printf 'You are here => %s\n' "$PWD"

You may also want to check out the short notation for the bash built-in test command [[ ]].

Recommendations:

Collapse
 
kilitr profile image
Kilian

can't wait for next time!
Please also give an detailed tour through piping

Collapse
 
thomcord profile image
Thomas Cordeiro

Nice article! Gives a good understanding on bash!