Skip to content

Instantly share code, notes, and snippets.

@gerhard
Last active September 24, 2015 20:48
Show Gist options
  • Save gerhard/f431560e03a52b1c2601 to your computer and use it in GitHub Desktop.
Save gerhard/f431560e03a52b1c2601 to your computer and use it in GitHub Desktop.
#!/bin/bash -e
while read
do
n="${REPLY#*:}"
(( sum += n ))
done < <( echo "a:1
b:2
c:3
d:4" )
echo "Sum: $sum"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment