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.

I've seen that rvm (ruby version manager) is installed using the following command:

bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )

So as I understand we get the script content and pass it to the bash (I believe < < and << is the same thing?) I am interested in the < < part, found following description on the net:

<< token Means use the current input stream as STDIN for the program until token is seen.

This is somehow not clear for me, can someone make an example or explain it in more simple way?

share|improve this question
add comment

2 Answers 2

up vote 31 down vote accepted

No, < < and << are not the same thing.

The first is composed of the common < redirection character combined with the first character of the <(command) syntax. This is a ksh93 construct (also found in bash and zsh) known as process substitution that takes the output of command and provides it in a file whose name refers to the other end of the pipe command is writing to.

In other word you can think of < <(command) as < file, where file contains the output of command.

share|improve this answer
    
Got it, thank you very much. –  Stonerain Oct 14 '11 at 22:17
4  
I learnt about this command a few days ago, it's a very useful command. The things which you can do with this are only limited by your imagination: e.g. this command gives you a list of only hidden files : diff <(ls) <(ls -a) –  Khaja Minhajuddin Oct 18 '11 at 3:06
    
This syntax might indeed be quite useful but in Stonerain's specific case, it doesn't seem to provide any added value compared to a simple pipe. –  jlliagre Nov 27 '11 at 9:57
    
In the above syntax it doesn't help. But if you change it slightly, it's much better: bash <(curl ...) instead of bash < <(curl ...) doesn't steal STDIN, so you're free to answer prompts and provide input in the script. –  tylerl Dec 21 '11 at 19:23
    
Using <() seems to be a great alternative for sending multiple $variables to commands directly, instead of having to needlessly write the $variables to files first. diff <(echo "$text1") <(echo "$text2") stackoverflow.com/questions/13437104/… –  Sepero Dec 6 '12 at 16:52
add comment

It is a convoluted way of doing the simpler:

curl -s https://raw.github.com/... | bash
share|improve this answer
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.