Re: backtick -C

From: Laurent Bercot <ska-skaware_at_skarnet.org>
Date: Thu, 03 Apr 2014 14:54:12 +0100

On 04/03/2014 12:27 PM, Vallo Kallaste wrote:
> Hi
>
> I noticed that backtick -C does not work for preceding spaces, but
> import -C does. Is it intentional?

  -C | -c | -d | -s only make sense when backtick is performing the
substitution itself, i.e. with the -E option (which is deprecated).

  In your examples, backtick puts the value into the environment, and
you perform the substitution explicitly with import. Value
transformations are only done at substitution time, so backtick's -C
option doesn't do anything.
  I should probably print a warning or error message when value
transformations are used without -E, but then again, -E is going away soon.


> This isn't exactly related, but how I can get rid of preceding
> space(s) or delimitors commonly. Using pipeline with sed is one way
> of course but.. well, any better ways?

  It depends on what you're using the strings for, and your definition
of "better" :)
  Value transformations, including crunching, were made so that execline
could easily process words coming from files or programs' output; in
that context, it made sense to handle delimitors *after* words.

  I'd say the way to handle preceding delimitors would be:
  - fix your input so you don't have them XD
  - if the input is meant to be split, as with multidefine or
forbacktickx, then just ignore the first word if it is empty
  - else, pipeline { sed ... } is the most generic way.

-- 
  Laurent
Received on Thu Apr 03 2014 - 13:54:12 UTC

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