- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- how to set PS1 in csh
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-27-2004 02:25 PM
тАО05-27-2004 02:25 PM
export PS1='mesap:$LOGNAME $PWD>'
but how i can set PS1 in c shell like this style?
thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-27-2004 03:35 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-27-2004 06:06 PM
тАО05-27-2004 06:06 PM
Re: how to set PS1 in csh
1. you single quote the prompt
2. csh does not know of $PWD and $LOGNAME
so if you set the prompt using
set prompt='mesap: $LOGNAME $PWD> '
it will prompt like
mesa: $LOGNAME $PWD>
not what you want. The default csh only knows about the exclamation mark, which is - unless escaped with a \ - replaced with the current command history buffer event number.
When you switch to more enhanced csh's, like tcsh - the best csh clone IMHO - you have a complete ouvre of interpreted specials. My prompt is like
set prompt="$prod%{`tput smul`%}%M:%{`tput rmul;tput dim`%}%/ %h %#%{`tput sgr0`%} "
for intelligent terminals (xterm) and
set prompt="$prod%B%M:%/ %h %# %b"
for simple vt320 emulators
tcsh is available from ftp://ftp.astron.com/pub/tcsh/ (source), http://hpux.connect.org.uk/hppd/hpux/Shells/tcsh-6.12.03/ (HP porting center) or - the most recent shiny new 6.13.00 - from my HP site:
USA Los Angeles http://mirrors.develooper.com/hpux/
SGP Singapore https://www.beepz.com/personal/merijn/
USA Chicago http://ww.hpux.ws/merijn/
NL Hoofddorp http://www.cmve.net/~merijn/
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-27-2004 06:35 PM
тАО05-27-2004 06:35 PM
Re: how to set PS1 in csh
prompt The string which is printed before reading each
command from the terminal. prompt may include any
of the following formatting sequences (+), which
are replaced by the given information:
%/ The current working directory.
%~ The current working directory, but with one's
home directory represented by `~' and other
users' home directories represented by `~user'
as per Filename substitution. `~user' substi?
tution happens only if the shell has already
used `~user' in a pathname in the current ses?
sion.
%c[[0]n], %.[[0]n]
The trailing component of the current working
directory, or n trailing components if a digit
n is given. If n begins with `0', the number
of skipped components precede the trailing
component(s) in the format `/
ing'. If the ellipsis shell variable is set,
skipped components are represented by an
ellipsis so the whole becomes `...trailing'.
`~' substitution is done as in `%~' above, but
the `~' component is ignored when counting
trailing components.
%C Like %c, but without `~' substitution.
%h, %!, !
The current history event number.
%M The full hostname.
%m The hostname up to the first `.'.
%S (%s)
Start (stop) standout mode.
%B (%b)
Start (stop) boldfacing mode.
%U (%u)
Start (stop) underline mode.
%t, %@
The time of day in 12-hour AM/PM format.
%T Like `%t', but in 24-hour format (but see the
ampm shell variable).
%p The `precise' time of day in 12-hour AM/PM
format, with seconds.
%P Like `%p', but in 24-hour format (but see the
ampm shell variable).
\c c is parsed as in bindkey.
^c c is parsed as in bindkey.
%% A single `%'.
%n The user name.
%j The number of jobs.
%d The weekday in `Day' format.
%D The day in `dd' format.
%w The month in `Mon' format.
%W The month in `mm' format.
%y The year in `yy' format.
%Y The year in `yyyy' format.
%l The shell's tty.
%L Clears from the end of the prompt to end of
the display or the end of the line.
%$ Expands the shell or environment variable name
immediately after the `$'.
%# `>' (or the first character of the promptchars
shell variable) for normal users, `#' (or the
second character of promptchars) for the supe?
ruser.
%{string%}
Includes string as a literal escape sequence.
It should be used only to change terminal
attributes and should not move the cursor
location. This cannot be the last sequence in
prompt.
%? The return code of the command executed just
before the prompt.
%R In prompt2, the status of the parser. In
prompt3, the corrected string. In history,
the history string.
`%B', `%S', `%U' and `%{string%}' are available in
only eight-bit-clean shells; see the version shell
variable.
And here's the list for bash:
prompt PS1 when it is ready to read a command, and the
secondary prompt PS2 when it needs more input to complete
a command. Bash allows these prompt strings to be cus?
tomized by inserting a number of backslash-escaped special
characters that are decoded as follows:
\a an ASCII bell character (07)
\d the date in "Weekday Month Date" format
(e.g., "Tue May 26")
\D{format}
the format is passed to strftime(3) and the
result is inserted into the prompt string;
an empty format results in a locale-specific
time representation. The braces are
required
\e an ASCII escape character (033)
\h the hostname up to the first `.'
\H the hostname
\j the number of jobs currently managed by the
shell
\l the basename of the shell's terminal device
name
\n newline
\r carriage return
\s the name of the shell, the basename of $0
(the portion following the final slash)
\t the current time in 24-hour HH:MM:SS format
\T the current time in 12-hour HH:MM:SS format
\@ the current time in 12-hour am/pm format
\A the current time in 24-hour HH:MM format
\u the username of the current user
\v the version of bash (e.g., 2.00)
\V the release of bash, version + patchelvel
(e.g., 2.00.0)
\w the current working directory
\W the basename of the current working direc
tory
\! the history number of this command
\# the command number of this command
\$ if the effective UID is 0, a #, otherwise a
$
\nnn the character corresponding to the octal
number nnn
\\ a backslash
\[ begin a sequence of non-printing characters,
which could be used to embed a terminal con?
trol sequence into the prompt
\] end a sequence of non-printing characters
Escapes for the posix sh:
PS1 The value of this parameter is expanded for parameter
substitution, to define the primary prompt string. The
default value is "$ ". The character ! in the primary
prompt string is replaced by the command number. See
the "Command Reentry" subsection.
For the ksh:
PS1 The value of this parameter is expanded for
parameter substitution, to define the primary
prompt string which, by default, is $ followed by
a space character. The character ! in the
primary prompt string is replaced by the command
number (see Command Re?entry below). To include a
! in the prompt, use !!.
ksh, bash, and posix-sh interpret environment variables in the prompt on *every* evaluation, which enables you to use
PS1='$PWD > '
you do have to use single quotes
Need I say more? :)
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-31-2004 01:38 PM
тАО05-31-2004 01:38 PM
Re: how to set PS1 in csh
It's really good
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-16-2004 10:37 PM
тАО06-16-2004 10:37 PM
Re: how to set PS1 in csh
set prompt = "mesap:`echo $LOGNAME` `pwd` \>"