Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- http://murga-linux.com/puppy/viewtopic.php?t=101911
- http://www.pearltrees.com/s243a/bash-script-strip-from-ruby/id15335212
- #!/bin/bash
- echo "determine the list of files to copy" > "`tty`"
- if [[ ${#inFile} -gt 0 ]]; then
- echo "Readnig in file." > "`tty`"
- #IFS=$(echo -en "\n\b")
- echo "-----------------Original Files-----------------------"
- echo "$(cat $inFile)"
- files=$(cat "$inFile" | ./strip_prefixes "$oldPrefix")
- echo "-----------------Stripped Files-----------------------"
- echo "$files"
- #IFS=" "
- else
- echo "reading files from pipe" > "`tty`"
- files="$(read -d EOF | ./strip_prefixes $oldPrefix)"
- fi
- if [[ ${#newPrefix} -gt 0 ]]; then
- echo "Appending Prefix" > "`tty`"
- files=$(./append_prefixes "$newPrefix" "$files")
- echo "-----------------Appended Files-----------------------"
- echo "$files"
- fi
- echo "determine where to copy the files"
- if [[ ${#dest} -gt 0 ]]; then
- echo "dest=$dest"
- else
- dest=pwd # asdf
- echo "dest=$dest"
- fi
- #Copy the files
- for aPath in $files; do
- echo "aPath=$aPath"
- echo "inFile=$inFile"
- ./cp_preserve_path "$dest" "$aPath"
- done
Advertisement
Add Comment
Please, Sign In to add comment