Hi
I am making a script where i want to redirect the output of ls -l to a file
Example
#ls -l fil1.txt > /opt/temp/a.txt
ac: No such file or directory
I want to capture output of this command
like here output is
ac: No such file or directory
can anyone help
RudiC
2
Try redirection of stderr:
#ls -l fil1.txt > /opt/temp/a.txt 2>errfile
HI
Its not working
>ls -l fil1.txt > /opt/temp/a.txt 2>errfile
Ambiguous output redirect.
>ls -l fil1.txt 2 > errfile
fil1.txt: No such file or directory
2: No such file or directory
>
>cat errfile
>
RudiC
4
# ls -l fil1.txt >a.txt 2>errfile
# cat errfile
ls: cannot access fil1.txt: No such file or directory
Please check your shell's man page for "redirection"