Hi all,
in a script if I have: VERSION="3.2.0"
I can do: echo jj-$VERSION-jj and get jj-3.2.0-jj
however if I do: echo jj_$VERSION_jj I get jj_
How do I get the $VERSION to work with the underscores like the dashes do.
Thanks,
Jerry
On Fri, Jun 11, 2010 at 10:04 AM, Jerry Geis geisj@pagestation.com wrote:
Hi all,
in a script if I have: VERSION="3.2.0"
I can do: echo jj-$VERSION-jj and get jj-3.2.0-jj
however if I do: echo jj_$VERSION_jj I get jj_
How do I get the $VERSION to work with the underscores like the dashes do.
You can use ${VERSION} to separate it.
How do I get the $VERSION to work with the underscores like the dashes do.
echo JJ_$VERSION_JJ ******************************************************************* This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept for the presence of computer viruses. www.Hubbell.com - Hubbell Incorporated**
On Fri, Jun 11, 2010 at 10:04 AM, Jerry Geis geisj@pagestation.com wrote:
Hi all,
in a script if I have: VERSION="3.2.0"
I can do: echo jj-$VERSION-jj and get jj-3.2.0-jj
however if I do: echo jj_$VERSION_jj I get jj_
How do I get the $VERSION to work with the underscores like the dashes do.
I see 4 ways:
echo jj_${VERSION}_jj
echo jj_"$VERSION"_jj
echo jj-$VERSION-jj | tr '-' '_'
printf jj_%s_jj $VERSION
I am sure there are others.
HTH,
-Bob
On Fri, Jun 11, 2010 at 10:04 AM, Jerry Geis geisj@pagestation.com wrote:
in a script if I have: VERSION="3.2.0"
I can do: echo jj-$VERSION-jj and get jj-3.2.0-jj
however if I do: echo jj_$VERSION_jj I get jj_
How do I get the $VERSION to work with the underscores like the dashes
echo _$VERSION_
mark
From: "m.roth@5-cent.us" m.roth@5-cent.us
On Fri, Jun 11, 2010 at 10:04 AM, Jerry Geis < if I do: echo jj_$VERSION_jj I get jj_ How do I get the $VERSION to work with the underscores like the dashes
echo _$VERSION_
Or:echo jj_${VERSION}_jj
JD
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of John Doe Sent: Friday, June 11, 2010 10:50 AM To: CentOS mailing list Subject: Re: [CentOS] script question
From: "m.roth@5-cent.us" m.roth@5-cent.us
On Fri, Jun 11, 2010 at 10:04 AM, Jerry Geis < if I do: echo jj_$VERSION_jj I get jj_ How do I get the $VERSION to work
with the
underscores like the dashes
echo _$VERSION_
Or:echo jj_${VERSION}_jj
?
Parenthesis didn't work for me... Braces and escape work. I gave the escape example, but I think the braces solution is the pedantically most proper. ******************************************************************* This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept for the presence of computer viruses. www.Hubbell.com - Hubbell Incorporated**