Set variable to contain stderr or stdout (redirect error to out stream)By neokrates, written on May 21, 2010 |
bash snippet |
- neokrates
- Email: uwarov@yahoo.com
- Website: http://www.thinkplexx.com
- Join date: 05-31-09
- Posts: 20
Rate it
Ad
Poll
Loading ...
Most popular search terms:
Stats
-
Since publication, this page was visited 620 time(s).
One-liner: set variable to contain stderr or stdout (redirect error to out stream)
Use 2>&1.
Example: Firefox may complain that it has not all packages it needs, capture what it complains about:
> firefoxSays=$(firefox --version 2>&1 ) ; echo $firefoxSays
REMARK: you can grep for particular problem, i.e. does Firefox complain about not having libdbus?:
> firefoxSays=$(firefox --version 2>&1 | grep libdbus ) ; echo $firefoxSays
|
TAGS
|
|
SOCIAL
|


















