Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Jul 2001 23:56:25 -0700
From:      Dima Dorfman <dima@unixfreak.org>
To:        kesu <kesu@kesuki.dyndns.org>
Cc:        bugs@freebsd.org
Subject:   Re: Shell variables don't expand always... 
Message-ID:  <20010718065625.7F3393E34@bazooka.unixfreak.org>
In-Reply-To: <20010718012832.P48799-100000@kesuki.dyndns.org>; from kesu@kesuki.dyndns.org on "Wed, 18 Jul 2001 01:41:04 -0500 (CDT)"

next in thread | previous in thread | raw e-mail | index | archive | help
kesu <kesu@kesuki.dyndns.org> writes:
> This bug seems to be a feature of someone who's never used a sh script to
> write html. Apparently "" allows variables to expand while '' does not.
> since `` is used to execute there are no other 'allowed' quote character
> that I can see (not for a shell anyways) The problem, html uses ""'s so
> unless I individually escape them i can't get variables to expand wfor
> auto generated html. I hate escapes... I always mess up my scripts when I
> use escapes and it takes me hours to figure out why, which is why I avoid
> them at all costs. These are simply 5 minute scripts designed to just
> automate a mundane and repetitive html writing task and I need the
> variable to expand and I need ""'s inside the html, and escapes drive me
> crazy. so when I upgraded last feb, and unknowningly broke a script I
> never thought to check on, and just today discovered why and how it broke
> I really have to nosider it a bug, enen though it was probably a feature
> for someone to write a script to auto generate some java/javascript (which
> might need the variables intact and probably hate escapes)

If you know it's not a bug, why did you send this message?  Yes, it is
a feature, and I for one find it useful; sometimes you simply don't
want variables to be expanded.  Furthermore, this will not be changed;
sh is governed by numerous standards, and changing it just for you
simple isn't acceptable to anybody else.

If you really don't want to use escapes, you can try something like
this:

	oq='"';
	cq='"';
	echo "<a href=${oq}http://www.freebsd.org/${cq}>FreeBSD</a>";

I.e., use a variable that will expand into a quote.  (I used two that
expand to the same thing for aesthetical reasons; you don't have to do
that.)

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010718065625.7F3393E34>