Re: Error using "xargs eval"
On Sep 7, 9:02 am, John <jan...@gmail.com> wrote:
> Hi,
>
> I've got some problems using xargs together with eval, maybe because
> it's not a regular command.
>
> Suppose I have a CGI script which receives a MAC address. I want to
> convert coded colons to colons. Right now I use something like this
> for doing that:
>
> echo "PARAM_mac=$PARAM_mac" | sed "s/%3A/:/g" > /tmp/tmp_mac$$
> . /tmp/tmp_mac$$
>
> It works fine, but it uses the harddrive. So I would like to do
> something like
>
> echo "PARAM_mac=$PARAM_mac" | sed "s/%3A/:/g" | xargs eval
>
> But that doesn't work since xargs doesn't understand how to execute
> eval. Is there any standard solution for that kind of problem?
>
> / John
What about moving the dot to in front of the CGI script? So use:
.. <your CGI SCRIPT>
ie:
<dot><space><your CGI SCRIPT>
I think this example shows how it might work:
Step 1:
root@ms:/tmp>cat c
#!/usr/bin/ksh93
eval 'PARAM_mac="aa:bb:cc:dd:11:22:33:44"'
Step 2:
root@ms:/tmp>. ./c
(Notice <dot><space>./c)
Step 3:
root@ms:/tmp>echo $PARAM_mac
aa:bb:cc:dd:11:22:33:44
Miles
|