Mailinglist Archive: opensuse-de (1546 mails)

< Previous Next >
Re: scrpiting
  • From: David Haller <dnh@xxxxxxxxxxxx>
  • Date: Sat, 12 Dec 2009 00:20:27 +0100
  • Message-id: <20091211232027.GA3758@xxxxxxxxxxxxxxxxxx>
Hallo,

Am Fre, 11 Dez 2009, Michael schrieb:
Am 11. Dezember 2009 14:39 schrieb David Haller <dnh@xxxxxxxxxxxx>:
Am Fre, 11 Dez 2009, Joerg Thuemmler schrieb:
[..]
tarcp ist ein recht praktisches Miniscript, welches ich aus alten
Unix-Zeiten mit mir rumschleppe, welches die Verzeichnisstruktur hübsch
synchronisiert:
==== Besser: ====
sd="$1"
td="$2"
shift 2
(cd "${sd}"; tar cpf - "$@") | (cd "${td}"; tar xpvf -)
====

Was macht das "$@" ?

==== man bash ====
PARAMETERS
[..]
Special Parameters
The shell treats several parameters specially. These
parameters may only be referenced; assignment to them is
not allowed.
* Expands to the positional parameters, starting from
one. When the expansion occurs within double
quotes, it expands to a single word with the value
of each parameter separated by the first character
of the IFS special variable. That is, "$*" is
equivalent to "$1c$2c...", where c is the first
character of the value of the IFS variable. If IFS
is unset, the parameters are separated by spaces.
If IFS is null, the parameters are joined without
intervening separators.
@ Expands to the positional parameters, starting from
one. When the expansion occurs within double
quotes, each parameter expands to a separate word.
That is, "$@" is equivalent to "$1" "$2" ... When
there are no positional parameters, "$@" and $@
expand to nothing (i.e., they are removed).
====


Ich habe zum testen nur mal schnell zwei Verzeichnisse genommen aber
da scheint das erst tar ja keine DAten zu bekommen??

michael@akazia:~/wrk> /home/michael/bin/tarcp.sh /home/michael/apps
/home/michael/bak

Das Script braucht noch ein Argument was (relativ zum
Quell-Verzeichnis, dem ersten Argument) einzupacken ist. Wenn alles:
dann '.' für's aktuelle Verzeichnis.

-dnh

--
The goal of Computer Science is to build something that will last at
least until we've finished building it. -- BSD fortune file
--
Um die Liste abzubestellen, schicken Sie eine Mail an:
opensuse-de+unsubscribe@xxxxxxxxxxxx
Um eine Liste aller verfuegbaren Kommandos zu bekommen, schicken
Sie eine Mail an: opensuse-de+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups