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

Re: sed question



Greg Wooledge wrote:
...
> Ideally, you'd just stop trying to use sed with user-supplied variables
> injected into the code.  Sed was never built to be safe for that kind of
> work.

  sed was designed to operate on streams.  a sequence of 
characters is a stream.  i don't see any reason why 
putting the variable into the middle of that expression 
means anything different.


> There are some alternatives at <https://mywiki.wooledge.org/BashFAQ/021>
> including one using perl which handles arbitrary user-supplied search
> and replace variables safely.

  no thanks.  if i want to get all formal i'd either write a
parser/lexical analyzer and a C program or python.  i've never
needed to use perl before and don't plan on picking it up now
for such a minor thing as the script i've been working on (that
the fragment is a part of).

  the point of doing something in bash is to do it quick and
see if the concept is useful enough.  if enough people decide
to use it then it can be more formalized.


  songbird


Reply to: