Last active
August 29, 2015 14:01
-
-
Save progrium/215e210851fbcff7d1b6 to your computer and use it in GitHub Desktop.
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
destructuring_assignment_for_named_local_args() { | |
declare numbers letters words | |
read numbers letters words <<<"$@" | |
echo "$numbers" | |
echo "$letters" | |
echo "$words" | |
} | |
destructuring_assignment_for_named_local_args 123 abc "Hello world" | |
# Actually, for local args, this is still probably preferrable: | |
declare_named_local_args() { | |
declare numbers="$1" letters="$2" words="$3" | |
echo "$numbers" | |
echo "$letters" | |
echo "$words" | |
} | |
declare_named_local_args 123 abc "Hello world" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment