quick question about solaris shells. How do i customise unix shell for sh, ksh, bash? For example i want my prompt like "username@machinename path >" . the path will change every time i change my path.
In the bourne shell (sh) there is no environment variable that holds the current working directory. I don't think you can do what you want in bourne shell.
_cd() {
cd $*
PS1="${PWD} >"
}
alias cd=_cd
cd .
or better, put this in .kshrc the add this to .profile :
ENV=${HOME}.kshrc ; export ENV
The difference is that .profile is executed when you log on, and .kshrc when you call a shell, so this way you don't lose the PS1 variable when you start a new shell.
hoope it helps.
Mike
I like that idea Mike, but unfortunately the alias command doesn't work in sh. Also, $PWD env variable is not maintained in bourne shell, so you would need a line in your function like:
PWD=`pwd`
Is there an equivalent to alias in the bourne shell?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.