yves Baumes yves Baumes - 1 year ago 85
Linux Question

": Command not found"

Some issue arise when sourcing one of your env file (a series of variable exporting)

for instance:

export MY_ROOT=/Soft/dev/blah/blah
export MY_BIN=${MY_ROOT}/bin

results in

$. my_env.sh
$echo $MY_BIN

=> "/bin" seems to overwrite the begining of the variable instead of suffixing it..

Any idea?

By the way every time we source this file, an error message is reported:

": Command not found"

Which is weird.. This message appears even though we comment its whole content.

The invoked shell at the begining seems good
, or

What about control characters? How to screen them on linux?

Answer Source

This will fix the line endings in the file:

dos2unix my_env.sh

There's no need for a shebang in a file that's only going to be sourced since it is run in the current shell anyway. However, as a comment it might be informative for human readers.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download