Hallo, On Fri, 19 Apr 2002, Kai Lindenberg wrote:
habe mal schnell was gecodet (deine Frage hat mein Bedürfnis nach einem solchen Programm geweckt):
das Script filtert aus "arguments" alles raus, was in "exclude" drin ist, zwar nicht schön, aber es machts. bei mir heißt es "no".
Nette Idee, die aber nicht funktioniert.
Beispiel: Skript "no"
#!/bin/bash # Syntax: no "wildcard" command files
exclude=`echo $1` command=$2 shift 2 args=$* for i in $exclude; do args=`echo $args | sed "s|$i||"` done $command $args
$ ls -b .. "foo"\nund\n"bar" a\ b anb no~ t\bte\bes\bst\bt a\nb a\\nb no t\b_e\b_s\b_t\b_ ziel /tmp/test/kranke_dateinamen/ziel (0) $ ../no "n*" cp ../* . ../no: ../"foo": No such file or directory cp: ../"foo": No such file or directory cp: und: No such file or directory cp: "bar": No such file or directory cp: ../a: No such file or directory cp: b: No such file or directory cp: ../a: No such file or directory cp: b: No such file or directory cp: ../ziel: omitting directory Mit tar klappts: /tmp/test/kranke_dateinamen/ziel (1) $ (cd ..; tar cp --exclude="no*" --exclude="ziel" .) | (tar xp; ) /tmp/test/kranke_dateinamen/ziel (0) $ ls -b "foo"\nund\n"bar" a\nb a\ b a\\nb anb t\b_e\b_s\b_t\b_ t\bte\bes\bst\bt /tmp/test/kranke_dateinamen/ziel (0) $ -dnh PS: Nein, so auf Anhieb hab ich das script nicht korrigieren koennen. -- If human beings don't keep exercising their lips, he thought, their mouths probably seize up. After a few months' consideration and observation he abandonded this theory in favor of a new one. If they don't keep on exercising their lips, he thought, their brains start working. -- THHGTTG