Skip to content

Instantly share code, notes, and snippets.

@smartwatermelon
Last active April 21, 2025 23:37
Show Gist options
  • Save smartwatermelon/21af7732257345a3635eba4d231c0fee to your computer and use it in GitHub Desktop.
Save smartwatermelon/21af7732257345a3635eba4d231c0fee to your computer and use it in GitHub Desktop.
@cassidoo's interview question from April 20, 2025, in Bash
# one-liner in Bash
$ target=3; for i in "flour:200" "sugar:100" "eggs:2"; do echo "${i%%:*}:$(( ${i##*:} * target ))"; done
flour:600
sugar:300
eggs:6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment