The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
EVal Khoomfire Shell Programming and Scripting 1 11-24-2008 08:05 AM
eval a variable that has a . ttshell Shell Programming and Scripting 3 06-11-2007 03:44 PM
using eval w/ echo wxornot Shell Programming and Scripting 2 01-17-2006 10:16 AM
using eval with set, wc, and expr wxornot Shell Programming and Scripting 2 01-08-2006 04:42 PM
Suse 7.1 Eval (where is it) amucci UNIX for Dummies Questions & Answers 3 08-04-2001 07:27 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 12-02-2008
royalibrahim royalibrahim is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 86
eval misconception

Hi, I have two files "foo" and "bar"


Code:
 $ cat foo
a is \$a and b is \$b


Code:
$ cat bar
car tree

using the below 'while' loop I expect the output to be: a is car and b is tree

Code:
while read a b; do
     eval echo $(cat foo)           # o/p: a is $a and b is $b
     eval "echo $(eval "cat foo")"  # o/p: a is $a and b is $b
done < bar

rather getting the one which I mentioned as 'o/p'. I am not very sure about eval, how it works, so pls explain and correct me where I have gone wrong.

Last edited by royalibrahim; 12-02-2008 at 05:23 AM..
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:44 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0