KlaPe schrieb:
Hallo miteinander,
bin eine absolute Linux/Unix-Null und werde es auch bleiben???
Problemstellung:
Benötige einen skript-Entwurf, der verschiedene befehle hintereinander durchführen soll, eventuell mit entsprechender "Zeituhr".
Beispiel:
es oll ein ordner "new_1" erstellt werden (Eingabe wäre "md new_1" - ENTER)
dann soll in den Ordner gewechselt werden (Eingabe wäre "cd new_1" - ENTER)
dann soll ein getit-befehl ausgeführt werden (Eingabe wäre "sh /home/getit -s=http://www.stryder.de/pics/ -cs=1 -ce=6 -sz=1 -pre=ec -suf= -ext=.jpg" - ENTER)
dann sollte das system z.B. 5 min. (ca wert) warten
dann sollte wieder in den überordner gewechselt werden (Eingabe wäre "cd" - ENTER)
dann sollte ein neuer Ordner angelegt werden usw.
Hat jemand ein script in der Art, bzw. wie müßte so ein script aufgebaut sein?
Vielen Dank für Unterstützung und Hilfe ......
KlaPe (Klaus-Peter)
PS: hier noch das GETIT-SCRIPT
********************************************************************************************************
#!/bin/sh
clear
Input="$1 $2 $3 $4 $5 $6 $7 $8 $9"
# Misc Stuff
if [ "$Input" = " " ] ; then
echo "Error not enough parameters, try --help"
exit
fi
if [ "$1" = "--info" ] ; then
echo "GetIt 0.2.1d"
echo "(c)copyright by United Programmer Group 2000-2005"
echo "written by Maniac"
echo "with support from VinciEx aka Kais0r"
echo "Use this script at your own risk"
echo "No WARRANTY"
exit
fi
if [ "$1" = "--help" ] ; then
echo "GetIt 0.2.1d"
echo "Other Commands: --info, -0"
echo "Usage: "
echo "sh getit -s=[Source] -cs=[CounterStart] -ce=[CounterEnd] -sz=[StepSize] -pre=[Prefix] -suf=[Suffix] -ext=[Extension]"
echo ""
echo "e.g."
echo "sh getit -s=www.google.de -cs=1 -ce=10 -sz=1 -pre=foo -suf=bar -ext=.jpg"
echo ""
echo ""
echo -e "-0\tLet the counter fill in zeros, to count like on digicams"
echo -e "\te.g. 0100 0010 0001 instead of 100 10 1"
exit
fi
# ----> Source Stuff <----
Part=`echo "$Input" | cut -d " " -f 1`
if [ "${Part:0:3}" = "-s=" ] ; then
URL="${Part:3}"
fi
if [ "${Part:0:3}" = "-cs" ] ; then
CounterStart="${Part:4}"
fi
if [ "${Part:0:3}" = "-ce" ] ; then
CounterEnd="${Part:4}"
fi
if [ "${Part:0:3}" = "-sz" ] ; then
StepSize="${Part:4}"
fi
if [ "${Part:0:4}" = "-pre" ] ; then
Prefix="${Part:5}"
fi
if [ "${Part:0:4}" = "-suf" ] ; then
Suffix="${Part:5}"
fi
if [ "${Part:0:4}" = "-ext" ] ; then
Extension="${Part:5}"
fi
if [ "${Part:0:2}" = "-0" ] ; then
InclZero="Yes"
fi
# ----> Same Shit for CounterStart <----
Part=`echo "$Input" | cut -d " " -f 2`
if [ "${Part:0:3}" = "-s=" ] ; then
URL="${Part:3}"
fi
if [ "${Part:0:3}" = "-cs" ] ; then
CounterStart="${Part:4}"
fi
if [ "${Part:0:3}" = "-ce" ] ; then
CounterEnd="${Part:4}"
fi
if [ "${Part:0:3}" = "-sz" ] ; then
StepSize="${Part:4}"
fi
if [ "${Part:0:4}" = "-pre" ] ; then
Prefix="${Part:5}"
fi
if [ "${Part:0:4}" = "-suf" ] ; then
Suffix="${Part:5}"
fi
if [ "${Part:0:4}" = "-ext" ] ; then
Extension="${Part:5}"
fi
if [ "${Part:0:2}" = "-0" ] ; then
InclZero="Yes"
fi
# ----> Same for Counter End <----
Part=`echo "$Input" | cut -d " " -f 3`
if [ "${Part:0:2}" = "-s=" ] ; then
URL="${Part:3}"
fi
if [ "${Part:0:3}" = "-cs" ] ; then
CounterStart="${Part:4}"
fi
if [ "${Part:0:3}" = "-ce" ] ; then
CounterEnd="${Part:4}"
fi
if [ "${Part:0:3}" = "-sz" ] ; then
StepSize="${Part:4}"
fi
if [ "${Part:0:4}" = "-pre" ] ; then
Prefix="${Part:5}"
fi
if [ "${Part:0:4}" = "-suf" ] ; then
Suffix="${Part:5}"
fi
if [ "${Part:0:4}" = "-ext" ] ; then
Extension="${Part:5}"
fi
if [ "${Part:0:2}" = "-0" ] ; then
InclZero="Yes"
fi
# ----> And again for StepSize <----
Part=`echo "$Input" | cut -d " " -f 4`
if [ "${Part:0:2}" = "-s=" ] ; then
URL="${Part:3}"
fi
if [ "${Part:0:3}" = "-cs" ] ; then
CounterStart="${Part:4}"
fi
if [ "${Part:0:3}" = "-ce" ] ; then
CounterEnd="${Part:4}"
fi
if [ "${Part:0:3}" = "-sz" ] ; then
StepSize="${Part:4}"
fi
if [ "${Part:0:4}" = "-pre" ] ; then
Prefix="${Part:5}"
fi
if [ "${Part:0:4}" = "-suf" ] ; then
Suffix="${Part:5}"
fi
if [ "${Part:0:4}" = "-ext" ] ; then
Extension="${Part:5}"
fi
if [ "${Part:0:2}" = "-0" ] ; then
InclZero="Yes"
fi
# ----> And again for Prefix <----
Part=`echo "$Input" | cut -d " " -f 5`
if [ "${Part:0:2}" = "-s=" ] ; then
URL="${Part:3}"
fi
if [ "${Part:0:3}" = "-cs" ] ; then
CounterStart="${Part:4}"
fi
if [ "${Part:0:3}" = "-ce" ] ; then
CounterEnd="${Part:4}"
fi
if [ "${Part:0:3}" = "-sz" ] ; then
StepSize="${Part:4}"
fi
if [ "${Part:0:4}" = "-pre" ] ; then
Prefix="${Part:5}"
fi
if [ "${Part:0:4}" = "-suf" ] ; then
Suffix="${Part:5}"
fi
if [ "${Part:0:4}" = "-ext" ] ; then
Extension="${Part:5}"
fi
if [ "${Part:0:2}" = "-0" ] ; then
InclZero="Yes"
fi
# ----> And again for Suffix <----
Part=`echo "$Input" | cut -d " " -f 6`
if [ "${Part:0:2}" = "-s=" ] ; then
URL="${Part:3}"
fi
if [ "${Part:0:3}" = "-cs" ] ; then
CounterStart="${Part:4}"
fi
if [ "${Part:0:3}" = "-ce" ] ; then
CounterEnd="${Part:4}"
fi
if [ "${Part:0:3}" = "-sz" ] ; then
StepSize="${Part:4}"
fi
if [ "${Part:0:4}" = "-pre" ] ; then
Prefix="${Part:5}"
fi
if [ "${Part:0:4}" = "-suf" ] ; then
Suffix="${Part:5}"
fi
if [ "${Part:0:4}" = "-ext" ] ; then
Extension="${Part:5}"
fi
if [ "${Part:0:2}" = "-0" ] ; then
InclZero="Yes"
fi
# ----> And the last one for Extension <----
Part=`echo "$Input" | cut -d " " -f 7`
if [ "${Part:0:2}" = "-s=" ] ; then
URL="${Part:3}"
fi
if [ "${Part:0:3}" = "-cs" ] ; then
CounterStart="${Part:4}"
fi
if [ "${Part:0:3}" = "-ce" ] ; then
CounterEnd="${Part:4}"
fi
if [ "${Part:0:3}" = "-sz" ] ; then
StepSize="${Part:4}"
fi
if [ "${Part:0:4}" = "-pre" ] ; then
Prefix="${Part:5}"
fi
if [ "${Part:0:4}" = "-suf" ] ; then
Suffix="${Part:5}"
fi
if [ "${Part:0:4}" = "-ext" ] ; then
Extension="${Part:5}"
fi
if [ "${Part:0:2}" = "-0" ] ; then
InclZero="Yes"
fi
echo "Information Summery:"
echo "-------------------------------------------------------"
echo -e "Source URL:\t" $URL
echo -e "CounterStart:\t" $CounterStart
echo -e "CounterEnd:\t" $CounterEnd
echo -e "Step-Size:\t" $StepSize
echo -e "Prefix:\t\t" $Prefix
echo -e "Suffix:\t\t" $Suffix
echo -e "Extension:\t" $Extension
if [ "$InclZero" = "" ] ; then
InclZero="No"
fi
echo -e "Fill in Zeros:\t" $InclZero
echo "-------------------------------------------------------"
echo ""
echo ""
echo "Starting in... 3"
sleep 1
echo "Starting in... 2"
sleep 1
echo "Starting in... 1"
sleep 1
echo "Starting NOW!"
COUNTER=$CounterEnd
until [ $COUNTER -lt $CounterStart ]; do
if [ "$InclZero" = "Yes" ] ; then
if [ "$COUNTER" -gt "999" ] ; then
COUNTER=$COUNTER
elif [ "$COUNTER" -gt "99" ] ; then
COUNTER="0$COUNTER"
elif [ "$COUNTER" -gt "9" ] ; then
COUNTER="00$COUNTER"
elif [ "$COUNTER" -gt "-1" ] ; then
COUNTER="000$COUNTER"
fi
echo "File: " $Prefix$COUNTER$Suffix$Extension
wget $URL/$Prefix$COUNTER$Suffix$Extension
else
echo "File: " $Prefix$COUNTER$Suffix$Extension
wget $URL/$Prefix$COUNTER$Suffix$Extension
fi
let COUNTER-=$StepSize
done
******************************************************************************************************