execline globbing

From: Profpatsch <mail_at_profpatsch.de>
Date: Tue, 24 Jul 2018 18:40:54 +0200

When I have a glob like:

elglob -0 fs somedir/*
if { test -n $fs }
ln -t otherdir $fs

the test will fail if there’s more than one file in `somedir`.
Is there a way to put a split variable into one variable again?

It feels kind of clumsy to use elglob, especially because of
the default verbatim input of the pattern if no expansion is
found. I can’t imagine any use case where I’d want that,
especially not as default behaviour.

Another fun effect:

> execlineb -c 'elglob -0 f doesnotexist/* if { test -z "${f}" } echo foo'
foo
> execlineb -c 'elglob -0 f doesnotexist/* if { test -n "${f}" } echo foo'
foo

So for `test`, the ominous “zero string” of execline is both
empty and non-empty!
Is there some elaboration somewhere what this zero string is?
And how do work with it?

--
Written with Emacs (mu4e) on NixOS.
Q: Why is this email five sentences or less?
A: http://five.sentenc.es/
May take up to five days to read your message. If it=E2=80=99s urgent, call me.
Received on Tue Jul 24 2018 - 16:40:54 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:38:49 UTC