A message for Linux.com registered users: We are in the process of making changes to the Linux forums. Starting Monday, 8/13/18 at 6:00 PM PT, you will be unable to access the forums. They will re-launch as soon as possible on Wednesday, 8/15/18 with new features and improved functionality. Thank you for your patience and stay tuned for the new improved forums.

May 12, 2011

superuser

Forums: 

Hi, I am new.

I have a simple question.

On Ubuntu, I made a script:

#!/bin/bash

if [ "$(id -u)" = "0" ]; then
echo "superuser"

else
echo "no"
fi

I called the file "boo".

When I run "boo" as a regular user it says "no". But when I sudo su it, it says "boo" is not a command. So, how do I make it output "superuser".

Hope this make sense.

Click Here!