sed command not work with variables? | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

sed command not work with variables?

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-12-2008
MaestroRage MaestroRage is offline
Registered User
 
Join Date: Feb 2008
Last Activity: 4 April 2009, 2:28 AM EDT
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
sed command not work with variables?

I am trying to write a simple script which will take a variable with sed to take a line out of a text and display it

#!/bin/sh
exec 3<list
while read list<&3
do
echo $list
sed -n '$list p'<list2
done


this does not work, yet when I replace the $list variable from the sed command and put in a definite value, it works just fine.

Anybody know whats going on here?
Sponsored Links
    #2  
Old 02-13-2008
agn agn is offline
Registered User
 
Join Date: Feb 2008
Last Activity: 6 August 2013, 7:49 AM EDT
Posts: 345
Thanks: 0
Thanked 21 Times in 21 Posts
Variable interpolation won't work inside single quotes. Try using double quotes.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Perl variables inside Net::Telnet::Cisco Module doesn't work ahmed_zaher Shell Programming and Scripting 5 12-22-2010 07:29 AM
reading external variables does not work ABE2202 Shell Programming and Scripting 2 08-03-2009 05:20 PM
cd command doesn't work through variables vipinchauhan222 Shell Programming and Scripting 16 05-02-2009 03:22 AM
assign a command line argument and a unix command to awk variables sweta_doshi Shell Programming and Scripting 0 08-08-2008 06:54 AM
Working with Script variables; seems like this should work... Chong Lee UNIX for Dummies Questions & Answers 2 07-27-2007 05:43 PM



All times are GMT -4. The time now is 03:14 PM.