Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- echo "john
- jeff
- jerry
- tom
- tim
- sam
- andrew
- kris" > /tmp/names
- let x=0
- cat /tmp/names |while read line
- do
- if [[ $x == 0 ]]
- then
- name1="$line"
- elif [[ $x == 1 ]]
- then
- name2="$line"
- else
- echo "$name1 is before $name2 and $line is after $name2"
- name1="$name2"
- name2="$line"
- fi
- let x++
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement