I need to implement a script (duplq.sh) that would rename all the text files existing in the current directory using the command line arguments. So if the command duplq.sh
duplq.sh
A possible solution...
#!/bin/sh NUMBERS=$(ls $1|sed -e 's/pic//g' -e 's/\.txt//g'|sort -n -r) for N in $NUMBERS do NEW=$(($N + 3)) echo "pic$N.txt -> pic$NEW.txt" mv "pic$N.txt" "pic$NEW.txt" done