Skip to content

Instantly share code, notes, and snippets.

@tateisu
Created May 27, 2012 16:11
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 tateisu/2814924 to your computer and use it in GitHub Desktop.
Save tateisu/2814924 to your computer and use it in GitHub Desktop.
bash function returns array
#!/bin/bash
abc=(a b c)
for (( I=0; I < ${#abc[*]}; ++I ))
do
echo $I ${abc[$I]}
done
function func1(){
echo "d e f"
}
def=(`func1`)
for (( I=0; I < ${#def[*]}; ++I ))
do
echo $I ${def[$I]}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment