0

By chance I produced the command echo #a, where a=house. The result of this command is blank, so I was intrigued started searching, but found nothing. So, why does #a evaluate to an empty string?

5

This is because the hash sign (#) is regarded as a comment in bash, so everything following # becomes a comment. In essence, if you have a line echo #$a or echo #a it will just print a blank line, which is the same as just typing echo.

If a is correctly assigned a value and you want to echo that value, you would do echo $a.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.