Unix Shell - eval in bash

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > September 2007 > eval in bash





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author eval in bash
nits

2007-09-19, 1:28 am

What exactly is the need of eval command in bash. As an example for
eval tldp.org-bash guide its given
y=`eval ls -l`
echo "$y"

But, even if we give y=`ls -l`
echo "$y"
it gives the same result. The special symbol " ` " is for command
substitution ?

Stachu 'Dozzie' K.

2007-09-19, 7:30 am

On 19.09.2007, nits <nitinsatish@gmail.com> wrote:
> What exactly is the need of eval command in bash. As an example for
> eval tldp.org-bash guide its given
> y=`eval ls -l`
> echo "$y"
>
> But, even if we give y=`ls -l`
> echo "$y"
> it gives the same result.


Try
y='ls -l'
eval "$y"

> The special symbol " ` " is for command
> substitution ?


It substitutes command output for the whole `...` string.

--
Secunia non olet.
Stanislaw Klekot
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com