LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Configuring Bourne Shell (https://www.linuxquestions.org/questions/linux-newbie-8/configuring-bourne-shell-711717/)

alsaf 03-15-2009 06:48 AM

Configuring Bourne Shell
 
Hi

This is more of a request for info rather than help.

I have a Cnm Minibook that uses the Bourne Shell. I was trying to amend it's startup file to change prompt and add aliases. On googling, I found that the Bourne shell's startup files are located in /etc/profile and $HOME/.profile.

The details of what I did is in my blog:

http://cnm-minibook-mucking-about.bl...erm-shell.html

I them did the same on the Bourne Shell on my Ubuntu machine and amended the /etc/profile and $HOME/.profile by changing the prompt to:

PS1='\u\w> '

When I type in sh to go into Bourne shell it still displays

$

Is this the normal behaviour of the Bourne Shell?

r3sistance 03-15-2009 08:15 AM

try /bin/bash and see if it works that way. also I believe the file edited should be ~/.bash_profile or ~/.bashrc generally if anything needs to be applied across all accounts then their is /etc/bashrc too I believe as ~/.bash_profile points at ~/.bashrc and ~/.bashrc points at /etc/bashrc but I use CentOS mainly what is Red Hat based, could be different for Debian based distros.

tronayne 03-15-2009 08:27 AM

In, say, /etc/profile you can set the prompt system-wide (and remember that you have to log out and log back in again for any changes you make to take effect):
Code:

# Get the name (without the domain part) of the host (this is fancy-schmancy)
export HOST="`uname -n`"
# Set the prompt system-wide
PS1='${HOST}-${USER}-${PWD}: '

Note the use of double quotes and "sideways pipe" in the assignment of HOST and the use of single quotes in the assignment of PS1.

Ought to work for you this way (or modify as you see fit).

A bare-bones default might look like this:
Code:

PS1='\u@\h:\w\$ '
And don't forget to define PS2 while you're at it
Code:

PS2='> '
And then be sure to export them
Code:

export PS1 PS2

brianL 03-15-2009 08:27 AM

I think sh in Ubuntu is a link to dash, not bash.


All times are GMT -5. The time now is 08:24 PM.