Thursday, March 4, 2010

Redirecting or error output to variable in shell

Spent couple of painful hours trying to do that. And eventually, here is the code which will output standard output into the file and error into the variable:

var=`(ls -l > ./file.txt) 2>&1`

bloody shell...

No comments: