i have a directory in which there are multiple tar files like
tweets10_1.tar
tweets10_2.tar
tweets10_8.tar
now i want to untar these files and keep them in a directory structure like
10_1
10_2
10_8
I have made a shell script
#!/bin/bash
for string in `ls` ; do
if [ $string == tweets10_*.tar*]; then
length=${#string}
folder=${string:6:$length-10}
mkdir /mnt/filer01/round2/twitter/$folder
tar -xvf $string -C /mnt/filer01/round2/twitter/$folder
fi
done
this is giving me error :3: [: missing ]
Please tell what is the problem