ok so i'm working through a tutorial to get rvm installed on my mac. the bash command to get rvm via curl is

curl -L https://get.rvm.io | bash -s stable

i understand the first half's curl command at location rvm.io, and that the result is piped to the subsequent bash command, but i'm not sure what that command is doing. My questions:

-s : im always confused about how to refer to these. what type of thing is this: a command line argument? a switch? something else?

-s : what is it doing? i have googled for about half an hour but not sure how to refer to it makes it difficult.

stable : what is this?

tl;dr : help me decipher the command bash -s stable

to those answering this post, i aspire to one day be as bash literate as you. until then, opstards such as myself thank you for the help!

1 Answer 1


The -s thing is called an option. In your case, it means that bash will be executed with the first positional parameter set. If you want to play with that:

$ bash -s let us set some positional parameters just for fun
$ # doh? nothing seemed to happen
$ # In fact here we're in a new instance of bash with the parameters set. Look:
$ echo "$3"
$ echo "$5"
$ # Get it?
$ printf "%s\n" "$@"
$ # Amazing!
$ # Let's get out of here!
$ exit
$ # (back to previous bash session)

In your case, the script downloaded via curl is sent to bash (so it will be executed) and will have the first positional parameter set to stable.

If ever you're stuck with options you don't know what they do: man bash and then type /-s this will more or less get you to where the -s option is described. Or if you want to know what the -u option does for sed: man sed and then type /-u.

Hope this helps!

  • What is a "positional parameter?" May 13, 2016 at 6:40
  • 2
    @MikeSchinkel: see the reference. Positional parameters are the variables denoted by digits, e.g., $1, $8. You can't set them directly. They are set automatically when you call a program or a function. For example with a function: fun() { echo "Parameter 2 is $2"; }. Then try fun hello world and fun "hello gniourf" "how are you?". May 13, 2016 at 6:45
  • Okay, thanks. But still confused; how is this different from not using the -s option? May 13, 2016 at 6:52
  • 1
    @MikeSchinkel Without the -s option: bash stable will look for the file stable and try to execute it. With the -s option: bash -s stable: will execute what comes on its stdin, with stable set as $1. May 13, 2016 at 7:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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