bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to make an alphabetical counter


From: David D
Subject: Re: how to make an alphabetical counter
Date: Mon, 24 Dec 2001 14:48:13 +0100

My objectif is to order some file (my mp3), into some directories, the
criteria is the first letter of the file, wich mean the first letter of the
artist name.

I make that script, nothing echo nothing moved, I surely forget something.

# 1-> a ... 26->z

# from 97 lower case -> 122

# from 65 upper case -> 90

declare -i number=97

while [ $number -le 122 ]

do

#echo "find -type d -name \"\$'\\$(printf %o "$[$number]")'*\" -exec mv -f
{} ./\$'\\$(printf %o "$[$number]")' \; "

#eval "find -type f -name \"^\$'\\$(printf %o "$[$number]")'*\" -exec echo
{} \; "

eval "find -type f -name \"^\$'\\$(printf %o "$[$number]")'*\" -exec mv -f
{} ./\$'\\$(printf %o "$[$number]")' \; "

number=$number+1

done



thanks.

> In fact I d like to make a bash script that create a dir for each of
> alphabetcal char something like :
>
> # 1-> a ... 26->z
>
> # from 97 lower case -> 122
>
> # from 65 upper case -> 90
>
> #number=1
>
> #eval "echo \$'\\$(printf %o "$[$number+65]")'"
>
> #number=$number+1
>
> #eval "echo \$'\\$(printf %o "$[$number+96]")'"
>
> # créer les 26 rep avec les lettres de l'alphabet
>
> number=97
>
> while [ $number -le 122 ]
>
> do
>
> eval "mkdir \$'\\$(printf %o "$[$number]")'"
>
> number=$number+1
>
> done
>
>
>
> but there is an error during the execution in the line :
>
> number=$number+1
>
> integer expression expected, how can i do to correct this.
>
>
>
> mc.
>
>
>
>
>
> > "David D" <address@hidden> wrote:
> > > Yes, I d like to make an alphabetical counter wich when I make ++ goes
> from
> > > a to b etc ...
> >
> > Use a numeric counter, and then to get the alphabetic character from
> > the number, use:
> > $ eval "echo \$'\\$(printf %o "$[$number+96]")'"
> >
> >
> > paul
>
>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]