Advertisement
nighthoodie

unk

Apr 23rd, 2014
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.61 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # truncate the filename to the $set number of characters
  4. ################################################################
  5. # usage:
  6. # unk <file>
  7. # unk .     # entire working directory (wildcard * doesn't work)
  8. ################################################################
  9.  
  10.  
  11. set="27"
  12.  
  13. ls="/bin/ls"
  14. echo="/bin/echo"
  15. cut="/usr/bin/cut"
  16. mv="/bin/mv"
  17.  
  18. #while [ "$1" != "" ]
  19. #do
  20.         for i in `ls "$1"`; do
  21.                 ext="${i: -4}"
  22. #               echo $ext
  23.                 nn=`echo "$i" | cut -c1-$set`
  24. #               echo $nn
  25. #               echo $nn$ext
  26.                 mv $i $nn$ext
  27.         done
  28. #done
  29. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement