User Tools

Site Tools


bash:output:troubleshooting:badly-written_commands

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

bash:output:troubleshooting:badly-written_commands [2021/01/26 15:17] – created peterbash:output:troubleshooting:badly-written_commands [2021/01/26 15:19] (current) peter
Line 1: Line 1:
 ====== 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:
 +
 +<code bash>
 +vers=$(python --version)
 +Python 2.7.13
 +echo "{$vers}"
 +{}
 +</code>
 +
 +<WRAP info>
 +**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.
 +
 +</WRAP>
  
bash/output/troubleshooting/badly-written_commands.1611674260.txt.gz · Last modified: 2021/01/26 15:17 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki