Sponsored Content
Top Forums Shell Programming and Scripting Script mit Laufvariable schlanker gestalten? Post 302385045 by Lock3 on Thursday 7th of January 2010 02:35:35 AM
Old 01-07-2010
Question Script mit Laufvariable schlanker gestalten?

Hiho.

Ich habe mit meinen rudimentären Scriptkenntnissen folgendes nicht sehr elegantes Script geschrieben und würde es gern in einer etwas eleganteren Form haben.

Code:
i=0                                                                                                                                    #herauslesen aller Dateien welche auf .sys enden und füllen eines Arrays
for Par in *.sys ; do
    Par2[$i]="$Par" ;
    i=$((i + 1)) ;
done
 
#Laufvariablen mit den Werten des Arrays füllen 
a=${Par2[0]} ; b=${Par2[1]} ; c=${Par2[2]}; d=${Par2[3]}; e=${Par2[4]}; f=${Par2[5]}; g=${Par2[6]}; h=${Para[7]}; i=${Par2[8]}; 
 
#Dateiendung aus Variablen entfernen 
a=`echo $a | sed 's/\(.*\).sys/\1/'` ; b=`echo $b | sed 's/\(.*\).sys/\1/'` ; c=`echo $c | sed 's/\(.*\).sys/\1/'`;
 
echo "eingebundene Modell"
echo "---------------------------------------"
echo " $a "
echo " $b "
echo " $c "
 
sleep 2
 
        echo " ++---------------------------------+"
        echo " || 01 (TI+MM) --> Alle Berechnen  "  
        echo " || 02 (TI+MM) --> $a Berechnen    "
        echo " || 03 (TI+MM) --> $b Berechnen    "
 
   read ANTW
   case $ANTW in
 
01) Anweisung1
02) Anweisung2
03) Anweisung3
 
esac

Dies ist exemplarisch für die Variablen a bis c . Das Script läuft bis Variable i, doch wenn ich mehr als diese 9 .sys-Dateien finden sollte wirds blöd.
Nun hab ich leider keine Ahnung, wie ich die Sache über die Laufvariable i allgemeingültiger gestalten kann. Smilie

Wäre für jeden Rat dankbar.

Mfg
die Locke
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Xlib: Invalid MIT-MAGIC-COOKIE-1

Anyone: I have a very annoying problem on one of our servers (running Solaris 8). when ever I try to run "xhost +" with the display set at "localhost:0.0" I get the following error: xhost + Xlib: connection to "finappprod:0.0" refused by server Xlib: Invalid... (1 Reply)
Discussion started by: errolg
1 Replies

2. Shell Programming and Scripting

Bash: Zeilen aus Datei mit cat und grep in dynamisches Array schreiben

Hallo, ich habe eine Datei "Kino.ini" die z.B. wie folgt aussieht * KINOFILM A bla bla KINOFILM B blubb blubb KINOFILM C Ich möchte nun die Datei "Kino.ini" per cat und grep auslesen und testen ob der String KINOFILM nur mit einem '*' am Anfang vorkommt. In dieser Beispieldatei... (3 Replies)
Discussion started by: ABE2202
3 Replies

3. Shell Programming and Scripting

shell script vorher batch mit curl

salve! this in windows command script (batch). i need it for mac....unix or linux @echo off Echo Router reconnect: AVM FRITZ!BOX FON WLAN 7170 curl "http://192.168.10.10:49000/upnp/control/WANIPConn1" -H "Content-Type: text/xml; charset="utf-8"" -H... (1 Reply)
Discussion started by: onkeldave
1 Replies

4. Shell Programming and Scripting

Script mit Laufvariable schlanker gestalten?

Hiho. Ich habe mit meinen rudimentären Scriptkenntnissen folgendes nicht sehr elegantes Script geschrieben und würde es gern in einer etwas eleganteren Form haben. i=0 ... (2 Replies)
Discussion started by: Lock3
2 Replies

5. Shell Programming and Scripting

mit Sed Text aus Datei nur nach dem ersten Treffer einfügen

Hello, I'm new in Shell scripting but i should write a script, which inserts the license header out of a txt-File into the files in our Projekt. For the Java classes it runs without Problems but for XML files not. At xml-files i have to put the license Header after the xml-Header (?xml... (2 Replies)
Discussion started by: PhoenixONE
2 Replies

6. Shell Programming and Scripting

Suchen und Ersetzen mit AWK

Hallo, ich habe mir mit meinen dürftigen Programmierkenntnissen ein Script zusammengebastelt über das ich in einem bestimmten Odner mit AWK alle Dateien eines Verzeichnis durchsuche und bestimmte Bezeichungen aller Dateien ändern kann. Es funktioniert auch soweit, nur hätte ich gerne auch die... (1 Reply)
Discussion started by: ruffi
1 Replies

7. Solaris

rdesktop zugriff auf W2K8R2 Farm mit NLB und Session Broke - server sent an unexpectedly long string

Hallo :-) Ich habe da ein Problem beim Zugriff von Solaris mittels rdesktop auf eine TS Farm unter W2K8R2 mit NLB und Session Broker. Ich bekomme folgende Fehlermeldung: user@sunray2xxx /h/user/Desktop 150 > rdesktop terminalserver WARNING: Remote desktop does not support colour... (1 Reply)
Discussion started by: chrischi1978
1 Replies

8. What is on Your Mind?

EdX - Founded by Harvard University and MIT in 2012

Is anyone actively learning, auditing or participating (for credit) at edX? There are some really great science and engineering programs there and they are all free to audit. For example, take a look at these classes related to: C Programming Quantum Physics Computer Science ... (6 Replies)
Discussion started by: Neo
6 Replies
AMANDA-SCRIPTS(7)						    Miscellanea 						 AMANDA-SCRIPTS(7)

NAME
amanda-scripts - Configuring and using the Script API DESCRIPTION
The Script API is a flexible system for invoking user-supplied scripts at various points in the execution of Amanda. This manual page describes the operation and configuration of the API. For help writing Script API scripts, see http://wiki.zmanda.com/index.php/Script_API. SCRIPTS
This section lists the scripts included with Amanda, see the individual man page for instructions on using them. For complete How-To information, consult the Amanda wiki at http://wiki.zmanda.com. o amzfs-snapshot(8), - create/destroy zfs snapshot. o script-email(8), - send email. Script properties work just like application properties: they are insensitive to case, and - (dash) and _ (underscore) may be used interchangeably. SCRIPTS OUTPUT PROPERTY
A pre-dle-amcheck, pre-dle-estimate or pre-dle-backup executed on the client can output property on stdout that are sent to the application. If the output line matches "PROPERTY str1 str2", Amanda sets a property called "str1" by the value of "str2", that property is sent to the application. SEE ALSO
amanda(8), amanda.conf(5) The Amanda Wiki: : http://wiki.zmanda.com/ AUTHORS
Jean-Louis Martineau <martineau@zmanda.com> Zmanda, Inc. (http://www.zmanda.com) Dustin J. Mitchell <dustin@zmanda.com> Zmanda, Inc. (http://www.zmanda.com) Amanda 3.3.1 02/21/2012 AMANDA-SCRIPTS(7)
All times are GMT -4. The time now is 03:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy