diff options
Diffstat (limited to 'bash')
-rw-r--r-- | bash/bashrc.d/readv.bash | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/bash/bashrc.d/readv.bash b/bash/bashrc.d/readv.bash new file mode 100644 index 00000000..5013dd89 --- /dev/null +++ b/bash/bashrc.d/readv.bash @@ -0,0 +1,26 @@ +readv() { + local arg + local -a opts names + for arg ; do + case $arg in + --) + shift + break + ;; + -*) + shift + opts[${#opts[@]}]=$arg + ;; + *) + break + ;; + esac + done + names=("$@") + builtin read "${opts[@]}" "${names[@]}" || return + for name in "${names[@]}" ; do + printf >&2 '%s: %s = %s\n' \ + "$FUNCNAME" "$name" "${!name}" + done +} + |