Skip to content

Instantly share code, notes, and snippets.

@talon
Created September 26, 2019 16:33
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 talon/602f030f9e6c24c16ce24c5f652179eb to your computer and use it in GitHub Desktop.
Save talon/602f030f9e6c24c16ce24c5f652179eb to your computer and use it in GitHub Desktop.
learning bash map
this_to_that() {
case "$1" in
# [learn]
*)
read -rp "$1: " value
local add="$1) echo \"$value\";;"
sed -i "/\[learn\]/i \ \ \ \ $add" "${BASH_SOURCE[0]}"
echo "$value"
;;
esac
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment