Created
July 29, 2014 19:26
-
-
Save papamoose/0b5442eeba00a05d1864 to your computer and use it in GitHub Desktop.
bash arrays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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