This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: System issue


this is not a cygwin issue ... but ...

>So your problem isn't with sed, it must be something 
>else- I admit, I really don't know all of 
>what is going on in that sprintf, but I would guess 
>it might be a quoting problem.
>
it is a quoting problem that has to do with how your language expands 
the quotes. for bash, the following does work ...

echo "the time right now is `date`"

where as in perl, the following does NOT work.

$var = "the time right now is `date`";
print $var;

now, if your program is written in C ... C doesn't have back-tick 
quoting ... you need to write a function similar to system() that 
actually manages the output redirection and stuff.

liulk

>Jorge Goncalvez wrote:
>
>>Hi I have a system issue in fact i have this code:
>> note("SET ARP (system)\n");
>>
>> a = inet_ntoa(*ia);
>> sprintf(buf, "arp -d %s; arp -s %s `echo %s | sed -e s/:/-/g`",
>>                   a, a, print_hw_addr(htype, hlen, haddr));
>>
>> status = system(buf);
>>
>>And the output is:
>>
>> arp -d 192.40.54.42; arp -s 192.40.54.42 `echo 00:80:9f:04:36:13 | sed -e
>>s/:/-/g`
>>
>> And I wanted to do is to interpret my sed command that seems to ne not
>>onterpreted
>> I wanted to tranform the third %s it is like that:xx:xx:xx:xx:xx:xx to
>>xx-xx-xx-xx-xx-xx
>>
>> Thanks.
>>



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]