Skip to content

Instantly share code, notes, and snippets.

@Kubuxu
Created December 20, 2016 19:53
Show Gist options
  • Save Kubuxu/4fff76bab75336f2b99e7e24c3c263e0 to your computer and use it in GitHub Desktop.
Save Kubuxu/4fff76bab75336f2b99e7e24c3c263e0 to your computer and use it in GitHub Desktop.
#!/bin/sh
(for p ; do
printf "%s\n" "$p"
done) | tac |
( read -r PREV ;
while read -r CURR ; do
printf '%s: | %s\n' "$PREV" "$CURR"
PREV="$CURR"
done) | tac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment