Advertisement
shadowsofme

Untitled

Dec 5th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.43 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. export FNAME=$1
  4.  
  5. function next() { echo $1; }
  6. function rest() { shift; echo $*; }
  7. space=" "
  8.  
  9. echo '' > results.txt
  10. function shifter() {
  11.     strings=$*
  12.  
  13.     for i in $strings; do
  14.         strings=$(rest $strings)$space$(next $strings);
  15.         if [ $(next $strings) != 'and' ]; then
  16.             echo $strings;
  17.             echo $strings >> results.txt;
  18.         fi
  19.     done
  20. }
  21.  
  22. while read name
  23. do
  24.     #strings=$(<"$FNAME");
  25.     shifter $name ;
  26. done < "$FNAME";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement