Sujet : Re: Executing Shell Pipelines with “find -exec”
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.unix.shell comp.os.linux.miscDate : 27. Apr 2024, 23:46:13
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v0jv7l$k8gh$4@dont-email.me>
References : 1 2
User-Agent : Pan/0.155 (Kherson; fc5a80b8)
On Sat, 27 Apr 2024 13:40:52 -0000 (UTC), Christian Weisgerber wrote:
This is problematic because the filename is simply interpolated into the
command string, which is then interpreted by sh. If the filename
contains whitespace or shell meta-characters, the results will be
unexpected.
That is true. I only realized it later, after posting.
You pass the filename as a positional parameter and reference it as such
in the command string.
Another possibility might be to use an environment variable. I have done
this in other scripts.