Sponsored Content
Full Discussion: prompt viarable
Top Forums UNIX for Advanced & Expert Users prompt viarable Post 46717 by hassan2 on Thursday 22nd of January 2004 12:56:33 PM
Old 01-22-2004
prompt viarable

My os is sun solaris 8

I have following prompt variable

PS1="`uname -n`$" ; export PS1

this work fine it set the hostname follow by $

but I just installed sudo
and when i issue sudo -s to gain root access
It still set my hostname follow by $
rather than setting hostname follow by #

I tried modifying my .profile so that it includes

UID=`id | awk '{print $1}' | cut -c5`

if [ "$UID" = "0" ]
then
PS1="`uname -n`#" ; export PS1
else
PS1="`uname -n`$" ; export PS1
fi

but this still did not work, when I issue sudo -s
Can you help, Please

Basically, I want to set my prompt variable in my .profile file so that when i sudo -s my PS1 is set
to hostname follow by #

Last edited by hassan2; 01-22-2004 at 02:22 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

prompt

how do we change the command prompt? right now my prompt says felix% where felix is the machine i´m on. but how do we change it? for example, how can i make it say me% and how do we get it to tell us what directory we are under because when i change into a subdir then the prompt... (1 Reply)
Discussion started by: eeldivady
1 Replies

2. UNIX for Dummies Questions & Answers

prompt why ?

Even though I give rm -f *, the files are listed for confirmation of removal . Why ? Thanks LS (2 Replies)
Discussion started by: ls1429
2 Replies

3. Solaris

Can't get ok prompt

Hi, I'm attempting to reinstall a damaged installation of Solaris 9 (on a SunFire). Connected via serial from a PC. Can't get to the "ok" prompt to launch install from CD. Ctrl+break acknowledges my request for a break, but no prompt. "#." gets me an "sc>" prompt, with several options, but... (3 Replies)
Discussion started by: shonenfan
3 Replies

4. Solaris

OK prompt

Here is a silly question: I have a Sun 220R and I need to get to the OK prompt. I can't hook up a monitor and keyboard to it. Its on a KVM right now and I also have a console connected to it. I can use PuTTY to get to the console and then connect to the 220R from there. How can I get to the... (3 Replies)
Discussion started by: hshapiro
3 Replies

5. Shell Programming and Scripting

How to a prompt a particular value???

Hi i am working with clearcase in my UNIX machine... Accidentally some had ran a script to check out all files in the machine.... Now i am actually trying to uncheck out all those files and had written a script for it.... The problem is that when ever i am trying to uncheck out the files, its... (2 Replies)
Discussion started by: grajesh_955
2 Replies

6. Solaris

ok prompt

There is a number before the ok prompt in OBP between brackets {}. It is 0 most of the time but sometimes it is different number {9} ok or {0} ok What does this number mean and how it gets changed? (3 Replies)
Discussion started by: StarSol
3 Replies

7. Solaris

how to get rid of ok prompt

Hi: My ultra 10 booted up to the ok prompt. does anyone how to get to the # prompt in normal mode? Alan (1 Reply)
Discussion started by: alanj9000
1 Replies

8. Solaris

No prompt!

We have a Solaris 10 machine. Today a weird issue happened. After login remotely via ssh, the motd appeared BUT there was no prompt! The prompt only appears after pressing Ctrl+d or Ctrl+c. Strange behaviour. I have checked /etc/profile and own user .profile, there is no anamoly. ... (11 Replies)
Discussion started by: sundar63
11 Replies

9. UNIX for Dummies Questions & Answers

How to Change the % prompt to - prompt in UNIX?

how to Change the % prompt to - prompt in unix :wall: ---------- Post updated at 07:40 AM ---------- Previous update was at 07:38 AM ---------- How To display the last modification time of any file in unix ---------- Post updated at 07:40 AM ---------- Previous update was at 07:40 AM... (2 Replies)
Discussion started by: manjiri sawant
2 Replies

10. Solaris

Unable to move from rsc prompt to ok prompt

Hi, on sunfire v890 unable to move from rsc prompt to ok prompt, i have executed the command break. (9 Replies)
Discussion started by: manoj.solaris
9 Replies
hostname(1)						      General Commands Manual						       hostname(1)

NAME
hostname - set or display name of current host system SYNOPSIS
[name_of_host] DESCRIPTION
The command displays the name of the current host, as given in the system call (see gethostname(2)). Users who have appropriate privileges can set the hostname by giving the argument name_of_host; this is usually done in the startup script The name_of_host argument is restricted to characters as defined in The system might be known by other names if networking products are supported. See the node manager documentation supplied with your sys- tem. WARNINGS
If the name_of_host argument is specified, the resulting host name change lasts only until the system is rebooted. To change the host name permanently, run the special initialization script (see Many types of networking services are supported on HP-UX, each of which uses a separately assigned system name and naming convention. To ensure predictable system behavior, it is essential that system names (also called host names or node names) be assigned in such a manner that they do not create conflicts when the various networking facilities interact with each other. The system does not rely on a single system name in a specific location, partly because different services use dissimilar name formats as explained below. The and commands assign system names as follows: +--------------+---------------+----------------+---------------------------+ |Node Name | Command | name Format | Used By | +--------------+---------------+----------------+---------------------------+ |Internet name | hostname name | sys[.x.y.z...] | ARPA and NFS Services | |UUCP name | uname -S name | sys | uucp and related programs | +--------------+--------------+---------------+-----------------------+--|Node-+-Name-------|Command-------+ |name Format |Used By | +--------------+--------------+---------------+-----------------------+ |Internet name |hostname name |sys[.x.y.z...] |ARPA and NFS Ser- vices | |UUCP name |uname -S name |sys |uucp, related programs | +--------------+--------------+---------------+-------- --------------+ where sys represents the assigned system name. It is recommended that sys be identical for all commands and locations and that the optional follow the specified notation for the particular ARPA/NFS environment. Internet names are also frequently called host names or domain names (which are different from NFS domain names). Refer to hostname(5) for more information about Internet naming conventions. Whenever the system name is changed in any file or by the use of any of the above commands, it should also be changed in all other loca- tions as well. Other files or commands in addition to those above (such as if used to circumvent for example) may contain or alter system names. To ensure correct operation, they should also use the same system name. System names are normally assigned by the script at start-up, and should not be altered elsewhere. Setting a hostname of more than 64 bytes is possible only with the appropriate configuration options enabled. It is strongly recommended that all related documentation be completely understood before setting a larger hostname. A hostname larger than 64 bytes can cause anoma- lous or incorrect behavior in applications which use the command or the system function to access the name. AUTHOR
was developed by the University of California, Berkeley. SEE ALSO
uname(1), gethostname(2), sethostname(2), uname(2), hostname(5), nodehostnamesize(5). hostname(1)
All times are GMT -4. The time now is 01:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy