LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Trouble assigning value to variable with (http://www.linuxquestions.org/questions/programming-9/trouble-assigning-value-to-variable-with-499569/)

fatsheep 11-07-2006 07:11 PM

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?

fatsheep 11-07-2006 07:44 PM

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.


All times are GMT -5. The time now is 06:11 PM.