Search code examples
linuxshellsuse

Why stream redirection operator &>> not working in SUSE linux?


My shell-script is failing on SUSE Linux as the stream-redirection operator I have used (&>>) is not working there, (But it is working fine in Other distributions). How can I correct this. Also I would like to know the standard way of doing the same which is supported by all Distributions?


Solution

  • The command you were using should mean you were using bourne shell:

    ls &>> file
    

    this command should redirect both stdout and stderr at the end of file. Another way to write it, again with a bourne shell could be:

    ls >> file 2>&1
    

    However it seems to me this way to write the command will be recognized by more shells, I think for instance ksh will recognize the second form but not the first.

    With csh or a csh-like shell you will need to use this syntax:

    ls >>& file
    

    Edit: I was confused because depending on the shell you can use &>> or >>& which are not the same.