06-30-2001
The prompt for bash shells can be changed by altering the PS1 variable.
PS1 can be declared in the global /etc/bashrc file or in ~/.bashrc.
My shell prompt looks like the following
[Sat Jun 30 15:32 andy@prosentia andy]>
The PS1 variable in my ~/.bashrc file looks like the following
PS1="[\d \t \u@\h \W]>"
\d is date
\t time
\u user
@\h @hostname
\W basename for current directory
the bash man file has details on different flags to alter the prompt
if your current directory was /usr/bin
PS1="me \W>" would show: me bin>
PS1="me \w>" would show: me /usr/bin>
Andy Hibbins
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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
2. Solaris
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
3. Solaris
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
4. Shell Programming and Scripting
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
5. Solaris
I currently have this as my prompt when I log in (shell is sh):
PS1="`hostname ` # "
My question is how do I add the current directory to that prompt? Is there a way?
Thanks. (5 Replies)
Discussion started by: kjbaumann
5 Replies
6. Solaris
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
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
8. Shell Programming and Scripting
Hello,
I am connectin to a remote server using:
ftp -n -i <server>
user <username> <password>
lcd ~/YAFFA
after i execute lcd command ther is a prompt:
"Local directory now /home/YAFFA"
How can is make it disappear?
:confused:
Please use and tags when posting code, data... (2 Replies)
Discussion started by: LiorAmitai
2 Replies
9. UNIX for Dummies Questions & Answers
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
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
LEARN ABOUT OPENSOLARIS
endusershell
getusershell(3C) Standard C Library Functions getusershell(3C)
NAME
getusershell, setusershell, endusershell - get legal user shells
SYNOPSIS
#include <unistd.h>
char *getusershell(void);
void setusershell(void);
void endusershell(void);
DESCRIPTION
The getusershell() function returns a pointer to a legal user shell as defined by the system manager in the file /etc/shells. If
/etc/shells does not exist, the following locations of the standard system shells are used in its place:
/bin/bash /bin/csh
/bin/jsh /bin/ksh
/bin/ksh93 /bin/pfcsh
/bin/pfksh /bin/pfsh
/bin/sh /bin/tcsh
/bin/zsh /sbin/jsh
/sbin/pfsh /sbin/sh
/usr/bin/bash /usr/bin/csh
/usr/bin/jsh /usr/bin/ksh
/usr/bin/ksh93 /usr/bin/pfcsh
/usr/bin/pfksh /usr/bin/pfsh
/usr/bin/sh /usr/bin/tcsh
/usr/bin/zsh /usr/sfw/bin/zsh
/usr/xpg4/bin/sh
The getusershell() function opens the file /etc/shells, if it exists, and returns the next entry in the list of shells.
The setusershell() function rewinds the file or the list.
The endusershell() function closes the file, frees any memory used by getusershell() and setusershell(), and rewinds the file /etc/shells.
RETURN VALUES
The getusershell() function returns a null pointer on EOF.
BUGS
All information is contained in memory that may be freed with a call to endusershell(), so it must be copied if it is to be saved.
NOTES
Restricted shells should not be listed in /etc/shells.
SunOS 5.11 1 Nov 2007 getusershell(3C)