Added friendly greetings
[clearscm.git] / bin / root
1 #!/bin/bash
2 ################################################################################
3 #
4 # File:         $RCSfile: root,v $
5 # Revision:     $Revision: 1.4 $
6 # Description:  Run a command/shell as root
7 # Author:       Andrew@DeFaria.com
8 # Created:      Mon Nov 13 16:14:30 1995
9 # Modified:     $Date: 2010/06/08 15:03:27 $
10 # Language:     Bash
11 #
12 # (c) Copyright 2000-2005, ClearSCM, Inc., all rights reserved.
13 #
14 ################################################################################
15 if [ $# -gt 0 ]; then
16   # Execute the commands
17   sudo "$@"
18 else
19   # Become a "wizard"!
20   # Source in profile
21   if [ -f ~/.rc/profile ]; then
22     . ~/.rc/profile
23   fi
24
25   # Source in functions (needed for set_title and set_prompt)
26   if [ -f ~/.rc/functions ]; then
27     . ~/.rc/functions
28   fi
29
30   sudo -s
31
32   # Reset title and prompt
33   # Note: I don't like doing this but an alias doesn't work...
34   if [ $ARCHITECTURE = "sun" ]; then
35     id=/usr/xpg4/bin/id
36   else
37     id=id
38   fi
39
40   set_title
41   set_prompt
42 fi