Register
It is currently Mon Jul 28, 2014 2:18 am

Convert upper to lower case


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Fri Jan 29, 2010 2:43 am   

Joined: Thu Jan 21, 2010 7:23 am
Posts: 6
I had to write this, and as much as it is useless, I thought: 'bah! I might as well share it...'

Code:
#!/bin/bash -
#===============================================================================
#
#          FILE:  up2low.sh
#
#         USAGE:  ./up2low.sh
#
#   DESCRIPTION:  converts upper to lower case for the directory you're in
#
#       OPTIONS:  ---
#  REQUIREMENTS:  tr
#          BUGS:  ---
#         NOTES:  ---
#        AUTHOR:  iesaya (---)
#       COMPANY:  ---
#       CREATED:  01/27/2010 08:04:51 PM CET
#      REVISION:  ---
#===============================================================================

for n in `ls`
do
  i=`echo $n | tr [:upper:] [:lower:]` #sets upper to lower in var
    if [ -e $i ]; then
      echo "file $i already exists"
    else
      echo "moving $n to $i"
      mv $n $i &> /dev/null
    fi
done

echo "done"
exit 0



Last edited by iesaya on Fri Jan 29, 2010 2:51 am, edited 1 time in total.

Top
 Profile  
 PostPosted: Fri Jan 29, 2010 2:45 am   
User avatar

Joined: Mon Jan 18, 2010 8:10 pm
Posts: 40
Sweet header!
:)


Top
 Profile  
 PostPosted: Fri Jan 29, 2010 2:54 am   

Joined: Thu Jan 21, 2010 7:23 am
Posts: 6
yeah... I'm using the vi-plugin Crouse recommended:
http://bashscripts.org/forum/viewtopic.php?f=7&t=963

It's a little overkill for that kind of script but it's never too early to acquire some new g00d habits =P


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP