Last active
August 29, 2015 14:01
This file contains hidden or 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