hawa wrote:
> Execuse me, would you give me a hand with a simple 'if' bash script?
> I want to make folders "00", "01",...,"20" and
> copy existing files file_00, file_01,....,file_20 to each folder.
> Thank you very much.
> 
> 
> 
> -------------------------------------
> for ((  i = 1 ;  i <= 20;  i++  ))
> do
> 
> if [ $i -gt 10 ]; then          foldername = $i
>         filename = "file_"
>         filename = $filename$i
> else
>         foldername = "0"$i   ##
>         filename ="file_0"   ##
>         file = $filename$i   ##
> fi
> 
> done

untested:

for ((  i = 1 ;  i <= 20;  i++  ))
do
  foldername=$(printf %02d $i)
  filename=$(printf file_%02d $i)

  # now, do whatever you want with $filename
  # and $foldername (cp, mv, rm, ...)
done

J.


Reply via email to