Re: [SLUG] sh sed problem

From: Kwan Lowe (kwan@digitalhermit.com)
Date: Tue Jan 20 2004 - 10:37:28 EST


>
>>> here's my test.sh:
>>>
>>> #!/bin/sh
>>> BLAH= echo "$1" | sed 's/.*\\//'
>>> echo $BLAH
>>> BLAH= ` echo "$1" | sed 's/.*\\//' `
>>> echo $BLAH
>>>
>>> if I call ./test.sh 'blah\blah' I see:
>>> blah
>>>
>>> sed: -e expression #1, char 7: Unterminated `s' command

>
> The second one was in backticks, but I get unterminated `s' command.

Ok, sorry...
You need to add an extra escape to your expression since the first will be
interpreted by the shell:

      5 BLAH=` echo "$1" | sed -e 's/.*\\\//' `
      6 echo $BLAH

Also, don't put spaces after the '=' sign.

-- 
* The Digital Hermit   http://www.digitalhermit.com
* Unix and Linux Solutions   kwan@digitalhermit.com
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS).  Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:26:20 EDT