30

RHEL 6

Is there a difference between the >> and >\> operators? I read the following blurb in a RHEL training book:

"You can add standard output to the end of an existing file with a double redirection arrow with a command such as ls >\> filelist

I'm more accustomed to the >> operator and when I try both, I get different results.

  • Using >> seems to append output to the file that follows it (as expected).
  • Using >\> seems to append output to a file literally called >

Is this a error in the book I'm reading? Or am I missing the author's point?

2
  • @Sirex short, but an answer.
    – jordanm
    Commented Feb 10, 2013 at 23:54
  • yeah, i guess !
    – Sirex
    Commented Feb 10, 2013 at 23:55

2 Answers 2

62

To append text to a file you use >>. To overwrite the data currently in that file, you use >. In general, in bash and other shells, you escape special characters using \.

So, when you use echo foo >\> what you are saying is "redirect to a file called >", but that is because you are escaping the second >. It is equivalent to using echo foo > \> which is the same as echo foo > '>'.

So, yes, as Sirex said, that is likely a typo in your book.

0
12

looks like a typo. .. ... .. ..

1
  • 1
    Thanks. Was wondering if I missing some glaringly simple linux concept here. =)
    – Mike B
    Commented Feb 10, 2013 at 23:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .