Im running a program in C which calls shell script. The script sometimes shows an error(SIOCSARP: Invalid argument)
The error is not really imporant, it occurs when the program tries to add local IP, it is not important here.
Is there a way to cut any output to the shell in linux here?
Shell script code:
#!/bin/sh
arp -s $1 $2
Running the script:
sprintf(script, "/home/add_arp.sh %s %s", tableI[i].IPaddr, tableI[i].MACaddr);
system(script);
Thanks
If the output you’re seeing is on standard error rather than standard output, you can use:
This will drop all error output in to the bit bucket. If it’s going to standard output and you want to be selective, you can use something like:
This will remove all lines containing that text.
You can also combine standard output and error to the standard output stream and be selective:
And finally, if you don’t want to see any output:
Although I wouldn’t use that last one myself unless I was sure I didn’t want to know about any problems.