The output message "Permission denied" comes from STDERR not from STDIN.<br>You should redirect stderr to stdin on your command, to make it work.<br><br>ifconfig wlan0 down 2>&1 | grep -i denied<br><br><br>

<div class="gmail_quote">On Sun, Oct 25, 2009 at 2:42 PM, Eugeneapolinary Ju <span dir="ltr"><<a href="mailto:eugeneapolinary81@yahoo.com">eugeneapolinary81@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">

I just wrote a little script, that will echo a message to the user, if it doesn't have enough permission:<br>
<br>
$ if ! [ "$(env LC_MESSAGES=C ifconfig wlan0 down | grep -i denied)" == "" ]; then echo "no permission"; fi<br>
SIOCSIFFLAGS: Permission denied<br>
$ sudo su<br>
[sudo] password for USER: <br>
# if ! [ "$(env LC_MESSAGES=C ifconfig wlan0 down | grep -i denied)" == "" ]; then echo "no permission"; fi<br>
# <br>
<br>
but it won't works<br>
<br>
why?<br>
</td></tr></tbody></table><br>

      <br>_______________________________________________<br>
CentOS mailing list<br>
<a href="mailto:CentOS@centos.org">CentOS@centos.org</a><br>
<a href="http://lists.centos.org/mailman/listinfo/centos" target="_blank">http://lists.centos.org/mailman/listinfo/centos</a><br>
<br></blockquote></div><br>