lavorando su OS X 10.8.3, ho una parte di ciò che voglio lavorare, sperando in aiuto con il resto
#!/bin/bash
# script accepts a path to base dir - base path to extract
# also accepts second param - archive /xys/there/usefulLib-version-3.2.1.zip
# 1. cd to base
# 2. get name path of file, 'useful-lib-version-3.2.1.zip'
# 3. strip away extn and -._ spaces so its 'usefulLibversion321' if possible make init char capital of each token (from second) before removing the separator like 'usefulLibVersion321'
# 4. if this folder exists in base then add 1 or 2 or 3 till we get a new folder name, create that. cd to that new folder
# 5. give extract command to original file here (like jar xp -file- or other)
cd $1
file1=$2
file1fullname=$(basename $file1)
file1name=${file1fullname%.*}
echo ${file1fullname}
echo ${file1name}
file1sname=${file1name//./}
file1sname=${file1sname//-/}
file1sname=${file1sname//_/}
file1sname=${file1sname// /}
echo ${file1sname}
mkdir ${file1sname}
cd ${file1sname}
#could use other extract command, i know this one of java
jar xf $2
Ho bisogno di aiuto con il punto 4.
Motivazione: espandi rapidamente i numerosi barattoli e altri archivi che scarico. alcune volte ottengono molti file .jar con spring e altri framework e utility.