Hi,
Ich hab hier ein Problem ne bestimmte Datei bei Bedarf fortlaufend nummeriert zu sichern.
Beispiel:
Ich hab ein Verzeichnis /home/trara
In diesem kann eine Datei mit Namen hallo.conf liegen, muss aber nicht.
Nun will ich aber in einem Script nen Befehl dazu haben falls eine hallo.conf
in /home/trara liegt diese in hallo1.conf umbenannt wird, und falls ich das Script wieder mal ausführe, und es liegt wieder eine hallo.conf dort, aber auch schon ne hallo1.conf
das dann die hallo.conf in hallo2.conf umbenannt wird usw. (also fortlaufend nummeriert)
Ist das machbar?
Hab ein bisschen mit dem nachstehenden Befehl gespielt
cd /home/trara
let a=1; for i in hallo*.conf; do let a=a+1; mv $i hallo$a.conf; done
Das klappt aber nur einmal > die hallo.conf wird dann in hallo2.conf umbenannt.
Führe ich den Befehl dann nochmal aus, klappts aber nicht mehr da dann schon eine
hallo2.conf vorhanden ist.
Es kommt dann die Meldung;
mv: »hallo2.conf« und »hallo2.conf« sind die gleiche Datei.
Ich aber will das hier keine Abfrage oder sonstiges kommt, sondern einfach ne
hallo3.conf, beim nächsten mal ne hallo4.conf usw.usw.. erstellt wird.
Gruss, Bert