Christopher Piro | 094823a | 2007-07-18 00:26:12 +0000 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | |
| 3 | if [ $# -eq 3 ]; then |
| 4 | OLD_PREFIX=$1 |
| 5 | NEW_PREFIX=$2 |
| 6 | FILENAME=$3 |
| 7 | NEW_FILENAME=$(echo $FILENAME | sed -e "s/$OLD_PREFIX/$NEW_PREFIX/") |
| 8 | echo "moving $FILENAME to $NEW_FILENAME" |
| 9 | mv $FILENAME $NEW_FILENAME |
| 10 | exit 0; |
| 11 | fi |
| 12 | |
| 13 | |
| 14 | if [ $# -eq 2 ]; then |
| 15 | while read line; |
| 16 | do |
| 17 | OLD_PREFIX=$1 |
| 18 | NEW_PREFIX=$2 |
| 19 | NEW_FILENAME=$(echo ${line} | sed -e "s/$OLD_PREFIX/$NEW_PREFIX/") |
| 20 | echo "moving ${line} to $NEW_FILENAME" |
| 21 | mv ${line} $NEW_FILENAME |
| 22 | done |
| 23 | exit 0 |
| 24 | fi |
| 25 | |