addprefix 206 B

12345678910111213
  1. #!/bin/bash
  2. # addprefix <prefix> <ext>
  3. SAVEIFS=$IFS
  4. IFS=$(echo -en "\n\b")
  5. prefix=$1
  6. ext=$2
  7. for i in $( ls *.$ext ); do
  8. echo "Moving $i to $prefix$i"
  9. mv $i $prefix$i
  10. done
  11. echo "Finished :)"
  12. IFS=$SAVEIFS