Bash Command: echo
The next command
echo simply prints out a message to the Bash shell’s Standard Output (STDOUT). An echo statement is very similar to the
print() method in Python3, or the
To use the
echo command we simply need to invoke the command with one argument that results in a string.
echo "Hello world".
echo commands are especially useful inside of Bash scripts. In any given Bash script many things may be happening and outputting some message to the individual that invokes the script is a very useful feature.
echo command can be used to easily view the contents of a Shell Variable. Your home directory, path, and many other variables are attached directly to your Bash Shell in the form of variables. You can use
echo $VARIABLE to easily view the contents of the variable.