beer9
asked on
what is the role of "bash -s"?
I see following line to install chefdk
I want to understand that does "bash -s -- -P chefdk" does and how does '-P' gets supplied as option to 'install.sh' and not to 'bash' ?
curl -L https://chef.io/chef/install.sh | sudo bash -s -- -P chefdk
I want to understand that does "bash -s -- -P chefdk" does and how does '-P' gets supplied as option to 'install.sh' and not to 'bash' ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi woolmilkporc,
> "bash will set the variables "$1" and "$2" of the "install.sh" code to "-P" or to "chefdk", respectively."
Does this mean that after running that whole one-liner, the 1st & 2nd "words" (for lack of a better word) of the output of the curl command will be accessible via $1 & $2?
Also, any ideas why "sudo" is being used here? Does it imply the user doesn't even have access to run bash without sudo?
> "bash will set the variables "$1" and "$2" of the "install.sh" code to "-P" or to "chefdk", respectively."
Does this mean that after running that whole one-liner, the 1st & 2nd "words" (for lack of a better word) of the output of the curl command will be accessible via $1 & $2?
Also, any ideas why "sudo" is being used here? Does it imply the user doesn't even have access to run bash without sudo?
Does this mean that after running that whole one-liner, the 1st & 2nd "words" (for lack of a better word) of the output of the curl command will be accessible via $1 & $2?No
Also, any ideas why "sudo" is being used here?Perhaps so that the commands in https://chef.io/chef/install.sh can be run as root
Does it imply the user doesn't even have access to run bash without sudo?No
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks ozo for a concise answer, as usual.
And thanks even more for a well explained answer, woolmilkpork.
And thanks even more for a well explained answer, woolmilkpork.
"--" lets bash treat everything which follows as positional parameters instead of options.
bash will set the variables "$1" and "$2" of the "install.sh" code to "-P" and to "chefdk", respectively.