Skip to content

Instantly share code, notes, and snippets.

@papamoose
Created July 29, 2014 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save papamoose/0b5442eeba00a05d1864 to your computer and use it in GitHub Desktop.
Save papamoose/0b5442eeba00a05d1864 to your computer and use it in GitHub Desktop.
bash arrays
#!/bin/bash
# ARGV as array
input=("$@")
# filename is first argument
filename="${input[0]}"
# get array size
height=${#input[@]}
# all users are after the first argument
users=( ${input[@]:1:$height} )
# test
echo $filename
echo ${users[@]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment