PureDevOps Community

Bash script prints "Command Not Found"

Sometimes it is trivial and not related to the logic, but we often make this mistake at the beginning of learning scripting

VAR_NAME = $(hostname)
echo "the hostname is ${VAR_NAME}"  

This will produce ‘command not found’ response. The correct way is to eliminate the spaces

VAR_NAME=$(hostname)