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
Your skill as shell programmer is?
- No skill (35%, 7 Votes)
- FreeTime coder (acceptable) (25%, 5 Votes)
- Developer (good) (15%, 3 Votes)
- Novice (15%, 3 Votes)
- Admin (very good) (10%, 2 Votes)
- Guru (perfect) (0%, 0 Votes)
Total Voters: 20
Loading ...
Most popular search terms:
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
|


















