bug-bash
[Top][All Lists]
Advanced

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

Re: `$x` adds single quotes during interpolation under Wrong Circumstanc


From: Chris F.A. Johnson
Subject: Re: `$x` adds single quotes during interpolation under Wrong Circumstances
Date: Fri, 2 Apr 2004 17:12:25 -0500 (EST)

On Fri, 2 Apr 2004, philo vivero wrote:

> > There is no bug here.  The single quotes in question are added by the
> > tracing code enabled by `set -x', so that output may be more easily
> > reused as input.
>
> Allow me to rephrase.
>
> How can I make "echo $a" return "*.log*" if there is a file called
> "install.log.syslog" in the cwd?

    You have to disable filename expansion:

set -f
echo $a


> :) touch install.log.syslog
> :) a=*.log*
> :) echo $a
> install.log.syslog                # sensible
> :) a=\*.log\*
> :) echo $a
> install.log.syslog                # !!!!!!!!!!!!!!!!!!!!!
> :) a='*.log*'
> :) echo $a
> install.log.syslog                # !!!!!!!!!!!!!!!!!!!!!
> :) a=\\\*.log\\\*
> :) echo $a
> \*.log\*                         # sensible
> :) a=\\*.log\\*
> :) echo $a
> \*.log\*                         # sensible
> :) bash --version
> GNU bash, version 2.05b.0(1)-release (i586-mandrake-linux-gnu)
> Copyright (C) 2002 Free Software Foundation, Inc.
>
>

-- 
        Chris F.A. Johnson                      http://cfaj.freeshell.org
        =================================================================
                Everything in moderation -- including moderation




reply via email to

[Prev in Thread] Current Thread [Next in Thread]