LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-07-2006, 07:11 PM   #1
fatsheep
Member
 
Registered: Sep 2006
Posts: 79

Rep: Reputation: 15
Trouble assigning value to variable with


Here's the command:

Quote:
sed_cur_pkg=`echo $cur_pkg | sed s%\/%\\\\/%g | sed s%\\.%\\\\.%g`
The output of echo $cur_pkg | sed s%\/%\\\\/%g | sed s%\\.%\\\\.%g is \/home\/ubuntu\/Desktop\/sources\/pkg\/lynx-2\.8\.6. This is what I want to assign to $sed_cur_pkg. However, when I echo $sed_cur_pkg it ouputs:
Quote:
...........................................
Why is this?

Last edited by fatsheep; 11-07-2006 at 07:12 PM.
 
Old 11-07-2006, 07:44 PM   #2
fatsheep
Member
 
Registered: Sep 2006
Posts: 79

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by fatsheep
Here's the command:



The output of echo $cur_pkg | sed s%\/%\\\\/%g | sed s%\\.%\\\\.%g is \/home\/ubuntu\/Desktop\/sources\/pkg\/lynx-2\.8\.6. This is what I want to assign to $sed_cur_pkg. However, when I echo $sed_cur_pkg it ouputs:

Why is this?
Switched the "%" chars to "@" and enclosed the sed expressions in '' and now it works.
 
  


Reply



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
getting rpoblem in assigning value to variable in if construct Ankit mittal Programming 9 01-07-2006 09:12 AM
assigning commands to a variable aunquarra Linux - General 5 01-04-2006 07:58 AM
in C, Assigning output of system() to a variable Miaire Programming 4 01-30-2005 12:40 PM
Assigning the output of one command to a variable (shell) guru_stew Programming 5 08-03-2003 06:12 PM
Assigning a string to a variable (not a pointer, not a array) JStew Programming 3 11-18-2002 08:13 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:03 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
Open Source Consulting | Domain Registration