Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
    
@Sirex short, but an answer. –  jordanm Feb 10 '13 at 23:54
    
yeah, i guess ! –  Sirex Feb 10 '13 at 23:55
add comment

2 Answers 2

up vote 12 down vote accepted

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.

share|improve this answer
    
Thanks for the explanation. –  Mike B Feb 11 '13 at 0:10
add comment

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

share|improve this answer
    
Thanks. Was wondering if I missing some glaringly simple linux concept here. =) –  Mike B Feb 10 '13 at 23:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.