Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #275362
| From | eben@gmx.us |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: Shell function & variable usage. |
| Date | 2024-12-07 00:50 +0100 |
| Message-ID | <JQQf8-eiHL-5@gated-at.bofh.it> (permalink) |
| References | <JQQ5r-eiDW-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 12/6/24 17:11, peter@easthope.ca wrote:
These
> rsync \
> --exclude '*.mp3' \
> --exclude '*.mp4' \
> rsync \
> --exclude=$exclusions
are not the same. In the first one you have "--exclude" for each pattern,
and in the second you have it once. I suspect the first one is correct, and
for that reason I vote for that one, even those typing "--exclude" several
times gives several opportunities for error. You could do something
overengineered like defining an array "excludepatterns" for patterns, and
then doing something like
rsync \
$(for pattern in ${excludepatterns[@]} ; do
echo -- "--exclude '$pattern'"
done)
Modulo mistakes, of course. And make sure it deals with wildcards, quotes,
and spaces appropriately.
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Shell function & variable usage. peter@easthope.ca - 2024-12-07 00:40 +0100
Re: Shell function & variable usage. Greg Wooledge <greg@wooledge.org> - 2024-12-07 00:50 +0100
Re: Shell function & variable usage. peter@easthope.ca - 2024-12-07 15:40 +0100
Re: Shell function & variable usage. Greg Wooledge <greg@wooledge.org> - 2024-12-07 17:10 +0100
Re: Shell function & variable usage. peter@easthope.ca - 2024-12-08 19:50 +0100
Re: Shell function & variable usage. eben@gmx.us - 2024-12-07 00:50 +0100
Re: Shell function & variable usage. eben@gmx.us - 2024-12-07 01:00 +0100
Re: Shell function & variable usage. Greg Wooledge <greg@wooledge.org> - 2024-12-07 01:00 +0100
Re: Shell function & variable usage. Karl Vogel <vogelke@pobox.com> - 2024-12-07 12:40 +0100
Re: Shell function & variable usage. Anssi Saari <anssi.saari@debian-user.mail.kapsi.fi> - 2024-12-11 14:30 +0100
csiph-web