Skip to content

Instantly share code, notes, and snippets.

@Rican7
Last active December 11, 2015 19:44
Show Gist options
  • Save Rican7/9a8e08572968315688d3 to your computer and use it in GitHub Desktop.
Save Rican7/9a8e08572968315688d3 to your computer and use it in GitHub Desktop.
Bash mapping data from an external file
(4) this
(2) is
(7) awesome
#!/usr/bin/env bash
# NOTE! Requires Bash v4.x
coproc cat ./external_list.txt
mapfile -u ${COPROC[0]} mapped_list
for name in "${mapped_list[@]}";
do
echo "(${#name}) $name"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment