Simón Ruiz wrote:
Ok, so let me see if I understand this...
So it's letting you take a string and run it as a command?
No, it's evaluating an expression. "x=something" isn't a command, it's
an expression. While both "ifconfig" and "x=something" work at the
commandline, bash doesn't try to interpret the contents of its
variables, so trying to "run" $evalstring will always cause it to look
for a command "x=something", if that makes sense.
Cheers,
Vern
Hmm...I guess I would have expect *this* to work:
[EMAIL PROTECTED]:~$ $evalstring
bash: x=something: command not found
Cause *this* works:
[EMAIL PROTECTED]:~$ if="ifconfig eth0"
[EMAIL PROTECTED]:~$ $if
eth0 Link encap:Ethernet HWaddr 00:0f:b0:6e:2b:4a
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:16
Thanks for the tips. I have much yet to learn...
Simón
On Sat, Oct 18, 2008 at 3:00 PM, Rob Ludwick <[EMAIL PROTECTED]> wrote:
lets say I have a program the echos a bunch of variables, say a
classpath...
I can't source the file in, I actually have to run it (becuase it might
be java or C), and it spits out something like:
"CLASSPATH=/blah/blah/blah.jar:/blah/blah/blah2.jar" or whatever a java
classpath needs to look like.
But running that in a subshell doesn't set it in the current shell.
So I do:
eval `get_java_classpath.exe`
And it sets the CLASSPATH in the current instance of the shell.
Another one is the resize command which spits out variables about the
size of the shell.
eval `resize` adjusts the variables in the current shell.
--R
On Sat, 2008-10-18 at 14:49 -0400, Simón Ruiz wrote:
Rob,
I don't get "eval". Was this mentioned on Thursday?
[EMAIL PROTECTED]:~$ x=5
[EMAIL PROTECTED]:~$ echo $x
5
[EMAIL PROTECTED]:~$ eval x=10
[EMAIL PROTECTED]:~$ echo $x
10
What value does it add?
Simón
On Sat, Oct 18, 2008 at 2:15 PM, Rob Ludwick <[EMAIL PROTECTED]> wrote:
Here's my quick list of bash shell tricks. I took the approach from
using them more or less in a shell script, but there is some more info
on setting up your bash shell prompt with a link to the color ascii
codes.
Among the books the Vern suggested, I also highly recommend Linux in a
Nutshell from O'Reilly.
--R
_______________________________________________
Fwlug mailing list
[email protected]
http://fortwaynelug.org/mailman/listinfo/fwlug_fortwaynelug.org
_______________________________________________
Fwlug mailing list
[email protected]
http://fortwaynelug.org/mailman/listinfo/fwlug_fortwaynelug.org
_______________________________________________
Fwlug mailing list
[email protected]
http://fortwaynelug.org/mailman/listinfo/fwlug_fortwaynelug.org
_______________________________________________
Fwlug mailing list
[email protected]
http://fortwaynelug.org/mailman/listinfo/fwlug_fortwaynelug.org
_______________________________________________
Fwlug mailing list
[email protected]
http://fortwaynelug.org/mailman/listinfo/fwlug_fortwaynelug.org