>
> Okay, hopefully a quickie for the sed and shell script masters.
>
> An argument to a script will be a string with an optional "\" in it. I want
> BLAH to be everything AFTER the "\" if present, or the whole string if no "\"
> is present.
>
> 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
>
>
> In neither case is BLAH getting set to anything useful. The first case is
> because the output is going to stdout, but in the second case, I thought BLAH
> would get set? It's the same sed comand, but with this usage I get an error?
> Help?
>
> Thanks,
> ~ Daniel
>
You need to put the expression in backticks.
BLAH=`echo something`
-- * 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:25:58 EDT