Поставил себе sudo, но при выполнении sudo -s знак с $ не меняется на #. Хотя при переключении через su $ меняется на #. Настройки профиля не менял (ни в /etc ни в home юзера). Видимо это траблы самого sudo. Как сделать что бы после переключение на root'a знак $ менялся на #?Пробовал делать так:
if [ "`id -u`" -eq 0 ]; then
PS1='\u@\h:\w\# '
else
PS1='\u@\h:\w\$ '
fiно ничего не выходит.
а id что говорит?
>а id что говорит?Что я root.
>[оверквотинг удален]
>Пробовал делать так:
>
>if [ "`id -u`" -eq 0 ]; then
> PS1='\u@\h:\w\# '
>else
> PS1='\u@\h:\w\$ '
>fi
>
>
>но ничего не выходит.man sudo
-i [command]
The -i (simulate initial login) option runs the shell specified in the passwd(5) entry of the target user
as a login shell. This means that login-specific resource files such as .profile or .login will be read by
the shell. If a command is specified, it is passed to the shell for execution. Otherwise, an interactive
shell is executed. sudo attempts to change to that user's home directory before running the shell. It
also initializes the environment, leaving DISPLAY and TERM unchanged, setting HOME, MAIL, SHELL, USER,
LOGNAME, and PATH, as well as the contents of /etc/environment on Linux and AIX systems. All other
environment variables are removed.И будет тебе щастье.
В этих случаях получаю оболочку root'a и права root'a. А мне нужно, что оболочка была моя и права root'a. Эффект такой же как и при выполнении команды su.
>В этих случаях получаю оболочку root'a и права root'a. А мне нужно,
>что оболочка была моя и права root'a. Эффект такой же как
>и при выполнении команды su.А-а. Ну в таком случае
man bash
=порезано=
PROMPTING
When executing interactively, bash displays the primary prompt PS1 when it is ready to read a command, and the sec-
ondary prompt PS2 when it needs more input to complete a command. Bash allows these prompt strings to be customized by
inserting a number of backslash-escaped special characters that are decoded as follows:=опять порезано=
\$ if the effective UID is 0, a #, otherwise a $
=закончили резать=PS1='\$'
Всем спасибо, проблема заключалась в том, что блок if был прописан 2-ды: в .profile и в .bashrc. Оставил в .profile и всё заработало.