I know this is very easy. I just am having a problem determining how to do it.
I want to have a 2-line command prompt when you hit return. I have no problem creating or exporting a PS1, but can't make into 2 lines.
hostname-user:/path/to/dir
#
I really should know this, but my brain is not fully engaged this fine Monday morning!
Thanks for helping all...
RTM
June 10, 2002, 12:41pm
2
set_prompt() {
case "$1" in
-ksh)
PS1='[$USER@$HOSTNAME]:$PWD
$ '
;;
-sh)
PWD=`pwd`
PS1="[$USER@$HOSTNAME]:$PWD
$ "
;;
esac
}
That is interesting, but somewhat long. I also don't necessarily need a conditional statement.
I just want it to show the path and then have the next line be the command prompt.
I know there is a way to have something like a newline character at the end of the prompt which will push the # to the next line.
Thanks for the info...
RTM
June 11, 2002, 11:30am
4
This was an example only - it was grabbed from .profile from one of my team.
What you wanted is what it does.
RTM
June 11, 2002, 11:45am
5
From the command line you can put in
# PS1='$PWD Control V Control J
# '
And you should get your present working directory on one line (put in what ever you want instead) and a # sign on the next...add a space for visual.
The Control V Control J would not be typed out.
Great, thanks for the help. I knew it was a simple solution, although not necessarily obvious to me.
Depending on the shell you are using, you can do it a few ways.
ksh and bash (i think) both support escape characters:
export PS1="Hello \n world \n $"
RTM
June 13, 2002, 10:23am
8
That did not work with ksh on either HP-UX or Solaris
$ PS1="Hello \n$"
Hello n$
Hello n$uname -a
HP-UX myserver B.11.00 A 9000/889 470662331 two-user license
Hello n$
Solaris 2.6
# echo $PS1
[$USER@$HOSTNAME]:$PWD #
root@server :/etc
# PS1="[$USER@$HOSTNAME]:$PWD\n#"
root@server :/etc/ftpdn#