On Thu, 31 May 2012 18:21:22 -0400 Dave <davestechs...@gmail.com> <davestechs...@gmail.com> wrote:
> Hi. What is the right way to have an iPython script check to see if > the user is currently root? > > Here's how I do it in bash scripts: > > > ########################## CHECK USERNAME PRIVILEGE > ################################ > > if [ $(id -u) != "0" ];then > echo "This script must be run as root." > exit 1 > fi import os if os.environ['USER'] != 'root': print('This script must be run as root.') exit(1) -- Corey Richardson _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor