LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-27-2007, 04:32 PM   #1
bmaheni
LQ Newbie
 
Registered: Dec 2007
Posts: 4

Rep: Reputation: 0
assign converted string to variable


I am trying to assign a converted first name to the variable new but when I do an $echo $new, instead of the converted name being displayed, the whole line after the '=' sign is displayed, what am I missing?

new='echo "$fname" | tr [A-Z] [a-z]'

Thanks.
 
Old 12-27-2007, 04:54 PM   #2
harry edwards
Member
 
Registered: Nov 2007
Location: Lincolnshire, UK
Distribution: CentOS, Fedora, and Suse
Posts: 365

Rep: Reputation: 48
I believe you meant to use the backward quote (`) instead if the single quote ('). This will force the script to execute the echo command and return the result into the variable.
 
Old 12-28-2007, 09:41 AM   #3
bmaheni
LQ Newbie
 
Registered: Dec 2007
Posts: 4

Original Poster
Rep: Reputation: 0
Harry,

It worked like a charm! Am new to scripting and have never used the backward quote before! Thanks, you are the man!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to assign a string to a structure variable in C? daYz Programming 7 06-13-2007 03:38 PM
bash script: how to assign an output (not the result) to a variable? Singing Banzo Programming 8 10-01-2006 07:29 PM
Shell script --cannot assign variable-- ralvez Programming 6 02-24-2006 05:56 PM
variable to string x2000koh Programming 4 07-30-2003 03:23 AM
Getting a variable name based on a string. jtshaw Programming 7 10-08-2002 03:06 PM


All times are GMT -5. The time now is 03:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration