What's the best command that allows me to do this:
- send the output of say
ls
to a file calledetcdir
- Print out the etcdir file using
cat
- Print out the exit status using
echo $?
- Breaking up the command into two lines.
I know its something like
sudo ls > etcdir && cat etcdir ??? \ echo $?
or
sudo ls > etcdir && cat etcdir; \ echo $?
~thanks in advance