Greetings..
I'm trying to build a script to manage my Mugen's chars, adding the chars to the game, searching the chars dir for .zip and .rar files, and then listing the nemes before the dots "." to a separate file in /tmp, and then create the folders for each file, copying the compacted files to their respective folders, and then uncompressing them there.
So, well, I'm getting some erros. The script does not work with some files, but try to do the same thing two times with others.
Well, this is the environment:
Code:
-rwxr-xr-x 1 oandarilho01 users 416 2006-11-27 01:31 adiciona_char.sh
-rw-r--r-- 1 oandarilho01 users 6,2M 2006-11-02 00:19 joker.rar
drwxr-xr-x 2 oandarilho01 users 496 2002-04-21 01:53 kfm
-rw-r--r-- 1 oandarilho01 users 1,1M 2006-11-02 07:51 kiriko.zip
-rw-r--r-- 1 oandarilho01 users 3,7M 2006-10-24 00:24 kyle.zip
-rw-r--r-- 1 oandarilho01 users 3,5M 2006-11-02 00:24 ngbc_ai.rar
-rw-r--r-- 1 oandarilho01 users 3,4M 2006-11-02 07:48 ngbc_fuuma.rar
-rw-r--r-- 1 oandarilho01 users 4,2M 2006-11-02 07:48 ngbc_kisarah.rar
-rw-r--r-- 1 oandarilho01 users 2,4M 2006-10-24 00:00 oni.zip
-rw-r--r-- 1 oandarilho01 users 4,3M 2006-11-02 00:12 Oswald_XI.zip
-rw-r--r-- 1 oandarilho01 users 1,6M 2006-11-02 00:10 rai-EX.rar
-rw-r--r-- 1 oandarilho01 users 101 2002-04-21 00:45 readme.txt
-rw-r--r-- 1 oandarilho01 users 6,7M 2006-10-24 00:24 rimle.zip
-rw-r--r-- 1 oandarilho01 users 627K 2006-11-02 07:51 shampoo.zip
-rw-r--r-- 1 oandarilho01 users 1,1M 2006-10-24 00:03 tetsuo_advance.zip
-rw-r--r-- 1 oandarilho01 users 5,1M 2006-11-02 00:18 xi_elisabeth.rar
-rw-r--r-- 1 oandarilho01 users 5,4M 2006-11-02 00:27 xi_jenet.rar
And this is the script:
Code:
#!/bin/bash
# Script para ajuste de Mugen - v0.01
#
# Definindo as variáveis de ambiente:
CHARDIR=`pwd`
# Criando pasta para o char
ls -l *.zip *.rar $CHARDIR | awk -F" " '{ print $8 }' | awk -F"." '{ print $1 }' > /tmp/novos
for char in `cat /tmp/novos`; do
mkdir $CHARDIR/$char
cp $char.zip $CHARDIR/$char
cd $CHARDIR/$char
unzip $char.zip
cd ..
done
rm /tmp/novos
Even either don't knowing or don't linking Mugen, I believe some of you could help me to improve this code..
So, I thank you all for the attention and help.