User Tools

Site Tools


bash:output:troubleshooting:badly-written_commands

BASH - Output - Troubleshooting - Badly-written commands

Some commands are not well-written, however, and may write information to the wrong place.

You must keep an eye out for such commands, and work around them when necessary.

For example:

vers=$(python --version)
Python 2.7.13
echo "{$vers}"
{}

NOTE: Even though we specifically asked for the version number, python wrote it to stderr.

Thus, it appeared on the terminal, and was not captured in the vers variable.

To fix, you would need to use 2>&1 here.

bash/output/troubleshooting/badly-written_commands.txt · Last modified: 2021/01/26 15:19 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki