Advertisement
s243a

strip_prefixes

Jan 16th, 2016
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.73 KB | None | 0 0
  1. # http://www.pearltrees.com/s243a/strip-prefixes-from-ruby-load/id15335221
  2. # http://murga-linux.com/puppy/viewtopic.php?t=101911
  3.  
  4. #!/bin/bash
  5.  
  6. echo "stripping prefixes" > "`tty`"
  7. echo '$1='"$1"  > "`tty`" # Print to terminal
  8. #for aPath in `read`; do
  9. if [[ ${#2} -gt 0 ]]; then
  10.   for aPath in $2; do
  11.     echo "aPath=$aPath"  > "`tty`" # Print to terminal
  12.     new="${aPath#$1}"
  13.     echo "new=$new"  > "`tty`"   # Print to terminal
  14.     echo "$new" # Write to pipe
  15.   done
  16. else
  17.     while read aPath; do
  18.     #echo "aPath=$aPath"  > "`tty`" # Print to terminal (This doesn't seem to work)
  19.     new="${aPath#$1}"
  20.     #echo "new=$new"  > "`tty`"   # Print to terminal (This doesn't seem to work)
  21.     echo "$new" # Write to pipe
  22.   done
  23. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement