help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: quote interpretation via vars without eval


From: Koichi Murase
Subject: Re: quote interpretation via vars without eval
Date: Tue, 16 Mar 2021 02:05:23 +0800

2021年3月15日(月) 7:26 Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com>:
> i learnt much by computer chat, more realtime multiline (later now irc 
> oneline) - i learned english on computers ( mac os pre x ) i mean it made 
> sense, more sense than super epyc processors nowdays with crappy software .. 
> :/

So, you learned the ``spoken'' language in text chat on computers and
don't have much experience in writing English in a more common style?

> about find, it does, actually i didnt benchmark but its mainly two reasons, 
> one is find may be slower ( 2x instead of 1x )

We should keep in mind that processing large data with Bash script is
slow. Usually, it's even slower than the fork & exec cost when the
number of processed data becomes tens or hundreds. Maybe you can use
`find' by default and switch to Bash implementation only when the
number of files is small.

But if you are going to use ls & awk, I don't know which one would be
faster. Anyway, using `find' is more robust than implementing
something in Bash or AWK by yourself. I see many failing corner cases
in your codes.

> and actually it prints filenames malformed with ? question marks instead of 
> exact meaning

Can you describe in more detail in what situation such question marks
are produced? I don't think `find' will generate question marks that
aren't in the original filenames.

> i guess it may be only declare i can use it i dunno where else it could be 
> useful excepts for commands where sadly eval must be used

Hmm... did you wanted to ask about the ways to initialize arrays when
you have a string of the form `array_name=(value-list)`? If so, you
may also use `source' other than `declare' family (declare, typeset,
local, etc.) and `eval'. For example,

  $ source /dev/stdin <<< "$string"  # if your system has /dev/stdin

or

  $ source <(echo "$string")  # With Bash 4.0+

--
Koichi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]