Hi everyone,

I wanted to ask a question about the bash output inside the terminal

The following procedure generates a command not found :

TEST:~ SniperDMC$
-bash: TEST.local: command not found

How to avoid this and beautify the output ?

Best regards



Well, $HOSTNAME is a variable, and if you just write it on a single line and press enter, bash will simply replace it with the respective value, i.e. "TEST.local". Since "TEST.local" is not a valid command, bash will complain.

If you want to print the value of any bash variable, you should use echo, i.e. echo $HOSTNAME.

For a quick bash scripting tutorial regarding variables, see here for example.

  • Hi and thanks for your answer. Is it possible that the bash recognizes the variable statement and do the "echo" via .bashrc ? – SniperDMC Sep 19 '17 at 6:46
  • If you mean whether it's possible to have bash automatically echo every variable instead of "just" replacing it, then no, this is not a good idea (and probably impossible). If you're only looking for a solution regarding your host name, I'd recommend using hostname instead (note the small letters) which is the common utility for printing the hostname. – Asmus Sep 19 '17 at 6:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .