<p>In Bash I'm executing a command and putting the result in a variable like this:</p>

<pre>export var=`svn ls`</pre>

<p>But if SVN fails for some reason--say it returns a non-zero error code--export still returns status code 0. How do I detect if the executed command fails?</p>

I had similar problem, it can be done like this:
```
rm -f error_marker_file
export var=`svn ls || touch error_marker_file`

[ -f error_marker_file ] && echo "error in executing svn ls"
```