Re: No escape from the dollar sign in SED

"Tim Chase [email protected] [sed-users]" <[email protected]> Wed, 4 Apr 2018 08:18:47 -0500
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
On 2018-04-04 04:07, [email protected] [sed-users] wrote:
> root@zero:~# usb='/mnt/stick'; echo 'Path $path is it!' | sed -r
> 's|'\\$'path'"|$usb|g" Path /mnt/stick is it! 

It seems like you really would be better off using `envsubst`
(available on all my linux & BSD boxes with anything that installed
the GNU gettext package):

  $ path='/mnt/stick'
  $ echo "Path $path is it!" | envsubst
  Path /mnt/stick is it!

It's a lot cleaner and won't get hung up on things like paths that
contain pipes or other odd characters.

I'm not positive it's available in a busybox environment as I don't
have one readily at hand.

-tim