Advertisement
shadowsofme

shiftLines

Dec 6th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.45 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. rm output.txt 2> /dev/null
  10. function shifter() {
  11.     start=$*   
  12.     strings=$(echo "${start//[$'\t\r\n']}");
  13.  
  14.     for i in $strings; do
  15.         strings=$(rest $strings)$space$(next $strings);
  16.         echo $strings;
  17.     done
  18. }
  19.  
  20. rm orig.txt 2> /dev/null
  21. while read name
  22. do
  23.     echo $name >> orig.txt 
  24.     #strings=$(<"$FNAME");
  25.     shifter $name ;
  26. done < "$FNAME";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement