I've written a tiny bash function which simply runs a command if $current_user_input = yes
function if_yes_run_with {
if [ $current_user_input = yes ]
then
$1
fi
}
I call it a number of times perfectly fine e.g:
if_yes_run_with 'brew update'
however, I've reached a point where I'd like to pass a command to it that includes a pipe:
if_yes_run_with '\curl -L https://get.rvm.io | bash -s stable'
the function appears to only evaluate command up to the pipe. The outcome of running it therefore gives the same result as:
if_yes_run_with \curl -L https://get.rvm.io
Can anyone help with passing a 'command with a pipe' as a parameter to a bash function?