On Thu, Aug 04, 2005 at 12:53:17PM +0200, Roland Illig wrote:
> >>really old shells will explode on your current version, too, but we
> >>really needn't to consider those.
>
> Why? Because of possible backslashes?
>
they do some interpretation of the expanded variables. iirc, backticks
were a pro
Oswald Buddenhagen wrote:
On Thu, Aug 04, 2005 at 07:31:42AM +0200, Oswald Buddenhagen wrote:
On Thu, Aug 04, 2005 at 01:19:50AM +0200, Roland Illig wrote:
quote() {
_sedexpr="s,',''',g"
_quotestr=`echo x"$1" | sed -e '1s,^x,,' -e "${_sedexpr}"`
echo "'${_quotestr}'"
On Thu, Aug 04, 2005 at 07:31:42AM +0200, Oswald Buddenhagen wrote:
> On Thu, Aug 04, 2005 at 01:19:50AM +0200, Roland Illig wrote:
> > quote() {
> > _sedexpr="s,',''',g"
> > _quotestr=`echo x"$1" | sed -e '1s,^x,,' -e "${_sedexpr}"`
> > echo "'${_quotestr}'"
> > }
> >
> >
On Thu, Aug 04, 2005 at 01:19:50AM +0200, Roland Illig wrote:
> quote() {
> _sedexpr="s,',''',g"
> _quotestr=`echo x"$1" | sed -e '1s,^x,,' -e "${_sedexpr}"`
> echo "'${_quotestr}'"
> }
>
> So if you ever use backticks, please don't use backslashes inside them.
>
yes, it
I have tried to write a proper shell quoting function, like this:
quote() {
_q=`echo x"$1" | sed -e '1s,^x,,' -e s,\',\'\'\',g`
echo "'${_q}'"
}
It converts foo'bar into 'foo'\''bar', as well as foo_bar into 'foo_bar'.
Note how I didn't use backticks inside the echo comm