This is my test .sh
file.
errorandoutput.sh
#!/bin/bash
echo myecho
ls dflj
If I run ./errorandoutput.sh >file 2>&1
,then we can get such file
But I hope the STDOUT
information is after the STDERR
.So I change the command into
./errorandoutput.sh >file 1>&2
But I get a empty file
.How to make the the STDOUT
information is after the STDERR
in a redirect file
?
I mean I hope I can get a file
like
ls: cannot access 'dflj': No such file or directory
myecho