The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


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 !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell Scripting Question vijaykrc UNIX for Dummies Questions & Answers 8 01-14-2008 08:08 AM
Shell Scripting Newbie mattyjim2 UNIX for Dummies Questions & Answers 1 10-11-2007 03:20 AM
Shell scripting newbie - please be gentle. charliemp3 Shell Programming and Scripting 2 08-01-2007 10:25 AM
Shell Scripting Question tech2040 Shell Programming and Scripting 3 08-09-2005 10:32 PM
Shell Scripting Question tech2040 Shell Programming and Scripting 1 08-08-2005 11:34 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 12-29-2006
Registered User
 

Join Date: Dec 2006
Posts: 2
shell scripting newbie question

Hi all!
I'm a newbie to shell scripting.
I want to create a script that will store a line from a text file in a variable so I can then use it to open firefox with that text in the address bar (the text file contains a list of addresses).
I have tried the following:
Code:
#!/bin/sh
a='sed -n 2p ~/text/text.txt'
firefox "${1:-$a}"
but it seems to open the address: "file:///home/MY_USERNAME/sed%20-n%202p%20~/text/text.txt".

Please help...
Reply With Quote
Forum Sponsor
  #2  
Old 12-29-2006
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
Replace the single quotes ' with backticks `

Code:
a=`sed -n '2p' ~/text/text.txt`
Cheers
ZB
Reply With Quote
  #3  
Old 12-29-2006
Registered User
 

Join Date: Dec 2006
Posts: 2
thanks!

Quote:
Originally Posted by zazzybob
Replace the single quotes ' with backticks `

Code:
a=`sed -n '2p' ~/text/text.txt`
Cheers
ZB
Thanks a lot, zazzybob!
It works now!
Previously I didn't even know of the existence of backticks...
Again, thanks a lot...
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:05 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0