Shell

Polytropon freebsd at edvax.de
Tue Jun 30 12:24:22 UTC 2020


On Mon, 29 Jun 2020 15:14:43 -0600, Brandon helsley wrote:
> There has been a difference in the hash sign of the command line.
> When I'm logged in as user it is $. When I am logged in as root
> it is #, even when I do not execute a shell.

After loggin in, a shell is _always_ executed (the so-called
login shell). On FreeBSD, the default is the C shell, but
maybe you have chosen a different shell?

You can always check your actual login shell with the following
command:

	echo $SHELL

You can check what prompt is defined (see below).



> Usually it was root at machine17#. How do I change it back? I have
> to do pwd instead of just knowing what directory I am in.

This depends on _which_ shell you are using. On FreeBSD, there
are the following possibilities:

/bin/sh - typically used for scripting or single-user mode

/bin/csh - default dialog shell, primarily for interactive use.

If you only get # and $ as a prompt character, it seems that
you accidentally changed from /bin/csh to /bin/sh. You now
have two options:

1. Start csh manually by entering "csh".

2. Change back to the C shell as login shell by entering
   the command "chsh" (change shell) and change /bin/sh
   to /bin/csh.

I would prefer number 2. ;-)

After making that change, you can check if the prompt is
now set correctly:

In /bin/sh, use:

	echo $PS1

in /bin/csh, use:

	echo $prompt

The second command should list a more complex string.

Note that the C shell per default uses # and % instead of
# and $ (like sh and bash and zsh) to differentiate between
root and non-root users.




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list