Sujet : Re: More Funny Stuff From Joel
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.os.linux.advocacyDate : 16. Jun 2024, 05:20:10
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v4llla$3s87h$3@dont-email.me>
References : 1 2 3 4 5 6 7 8 9
User-Agent : Pan/0.158 (Avdiivka; )
On Sat, 15 Jun 2024 21:28:37 -0400, Joel wrote:
Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
You ever find the need to write little utility shell scripts, at least?
To do what?
Example: I did one to mirror a selected subset of my programming
projects to my laptop. It only copied project directories that already
existed on the laptop.
dir=projects
remote=«main machine»
local=«laptop»
if [ $(hostname) != "$local" ]; then
echo "$0: run this on $local" 1>&2
exit 3
fi
IFS=$'\n'
flags="-AlprtX"
cd ~/$dir
# first matching rule applies, so put explicit includes before wildcard exclude
rsync ${flags} --delete --verbose \
$(for d in */; do echo --include="/$d"; done) --exclude=/\* \
$remote:$dir/ ./