[CentOS] permission script

Mon Oct 26 01:27:31 UTC 2009
Vinicius Coque <vcoque at gmail.com>

The output message "Permission denied" comes from STDERR not from STDIN.
You should redirect stderr to stdin on your command, to make it work.

ifconfig wlan0 down 2>&1 | grep -i denied


On Sun, Oct 25, 2009 at 2:42 PM, Eugeneapolinary Ju <
eugeneapolinary81 at yahoo.com> wrote:

>  I just wrote a little script, that will echo a message to the user, if it
> doesn't have enough permission:
>
> $ if ! [ "$(env LC_MESSAGES=C ifconfig wlan0 down | grep -i denied)" == ""
> ]; then echo "no permission"; fi
> SIOCSIFFLAGS: Permission denied
> $ sudo su
> [sudo] password for USER:
> # if ! [ "$(env LC_MESSAGES=C ifconfig wlan0 down | grep -i denied)" == ""
> ]; then echo "no permission"; fi
> #
>
> but it won't works
>
> why?
>
>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos/attachments/20091025/36209888/attachment-0005.html>