webber wrote:
> 
> A crude script is:
> ------------------------------------------------------------
> #!/bin/bash 
> 
> # This would work only with files whose names start with
> # alpha-numeric chars. 
> 
> # Enter fully qualified path of the target directory here. The script
> # itself should not reside in this directory or it would rename itself.
> FILE_DIR=temp 
> 
> cd ${FILE_DIR}
> for i in `ls -1tr *` ; do
>     f_char=`echo ${i} |cut -c1`
> case $f_char in
> [aA])num=1 ;; [bB])num=2 ;; [cC])num=3 ;; [dD])num=4 ;; [eE])num=5 ;;
> [fF])num=6 ;; [gG])num=7 ;; [hH])num=8 ;; [iI])num=9 ;; [jJ])num=10 ;;
> [kK])num=11 ;; [lL])num=12 ;; [mM])num=13 ;; [nN])num=14 ;;
> [oO])num=15 ;; [pP])num=16 ;; [qQ])num=17 ;; [rR])num=18 ;;
> [sS])num=19 ;; [tT])num=20 ;; [uU])num=21 ;; [vV])num=22 ;;
> [wW])num=23 ;; [xX])num=24 ;; [yY])num=25 ;; [zZ])num=26 ;;
> 0)num=27 ;; 1)num=28 ;; 2)num=29 ;; 3)num=30 ;; 4)num=31 ;;
> 5)num=32 ;; 6)num=33 ;; 7)num=34 ;; 8)num=35 ;; 9)num=36 ;;
> esac
>     val=${var[$num]:=1}
>     if [ "${#val}" -eq 1 ] ; then
>         val="0${val}"
>     fi
>     mv ${i} ${i}.${f_char}${val}
>     val=`expr ${val} + 1`
>     var[$num]=${val}
> done

Hello Soumen, thanks for the efforts ! I put the script in the file "rf".
On my m/c yr script gives this error message : 

rf: ${var[$num]:= 1} bad substitution 

My temp dir contains following files: 

aaa.tmp
abaa.tmp
bab.tmp
baba.t
babaa.tmp
ababa.tmp
ccbaba.t 

I placed script "rf" in "root" dir, my temp dir is under \root, I executed 
the "rf" from within "\root".  Any thing wrong ?
Am using "bash" . RH5.2 (Apollo) K2.0.36  . 

Thanks ! 

~ Pat


-------------------------------------------------------
This sf.net email is sponsored by: Jabber Inc.
Don't miss the IM event of the season | Special offer for OSDN members! 
JabConf 2002, Aug. 20-22, Keystone, CO http://www.jabberconf.com/osdn
_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help

Reply via email to