Skip to content

Instantly share code, notes, and snippets.

@decklin
Created January 14, 2015 15:49
Show Gist options
  • Save decklin/8b255647836df89f8612 to your computer and use it in GitHub Desktop.
Save decklin/8b255647836df89f8612 to your computer and use it in GitHub Desktop.
$ set -- one 'foo bar' three
$ ruby -e 'puts ARGV.count, ARGV.last' "$@ extra"
3
three extra
$ args="$@ extra"
$ ruby -e 'puts ARGV.count, ARGV.last' "$args"
1
one foo bar three extra
$ ruby -e 'puts ARGV.count, ARGV.last' $args
5
extra
$ argsarr=("$@")
$ ruby -e 'puts ARGV.count, ARGV.last' "${argsarr[@]} extra"
3
three extra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment