SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I just did a clean install of Slackware 15, everything went well except I have 2 problems. when in user mode terminal displays a # sign.
I have searched and tried everything I found on web but to no joy.
My second problem is that I cannot get .bashrc to run when in root
to be able to add colors, aliases etc. I assume that one problem solved will probably correct both. but I have not been able to find that solution.
# ~/.bash_profile ######################################################
case $- in
*i* ) # Interactive shell
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
;;
esac
########################################################################
Code:
# ~/.bashrc ############################################################
[ -r "$ENV" ] && . "$ENV"
[ -r /etc/bashrc ] && . /etc/bashrc
shopt -s checkwinsize # Keep track of terminal size
# Aliases:
alias less='less -XFRM'
# Bail out if we're not on a full-feature terminal:
if [ "$TERM" == 'dumb' ]; then
return 0
fi
# ANSI Terminal control sequences to implement text styles,
# for use in prompts (and/or elsewhere):
declare -A style=(
[default]=$( tput -S <<< $'sgr0\nop' )
[prompt]=$( tput -S <<< $'sgr0\nop\nbold' )
[input]=$( tput -S <<< $'sgr0\nop\nbold\nsetaf 5' )
[warning]=$( tput -S <<< $'sgr0\nop\nbold\nsetaf 3' )
[error]=$( tput -S <<< $'sgr0\nop\nbold\nsetaf 1' )
)
# Bash prompts:
# 'trap' ensures we clean up after ourselves on exit.
trap "tput -S <<< $'sgr0\nop'" EXIT
PS1=\\[${style[prompt]}\\]\\$\ \\[${style[input]}\\]
PS2=\\[${style[prompt]}\\]\>\ \\[${style[input]}\\]
PS0=${style[default]}
########################################################################
I just did a clean install of Slackware 15, everything went well except I have 2 problems. when in user mode terminal displays a # sign.
I have searched and tried everything I found on web but to no joy.
That sounds like you are logging in as root user. Is it safe to assume you have created a non-root user and are logging in with that user? The # symbol indicates a root terminal, usually. Forgive me if this is too obvious and you have already ruled that out.
$cat bashPrompt
#!/bin/bash
# Test to see what terminal we have and change the prompt accordingly
if [ $TERM == linux ]; then
if [[ $(id -u) == 0 ]]; then
export PS1="[\[\e[31m\]\u\[\e[m\]]-[\[\e[32m\]\w\[\e[m\]] \n\[$(tput sgr0)\][\[\e[36m\]\A\[\e[m\]]--> "
else
export PS1="[\[\e[1;34m\]\u\[\e[m\]]-[\[\e[32m\]\w\[\e[m\]] \n\[$(tput sgr0)\][\[\e[36m\]\A\[\e[m\]]--> "
fi
else
compile_prompt () {
local EXIT=$?
local CONNECTBAR_DOWN=$'\u250C\u2500\u257C'
local CONNECTBAR_UP=$'\u2514\u2500\u257C'
local SPLITBAR=$'\u257E\u2500\u257C'
local ARROW=$'\u25B6'
local c_gray='\e[01;30m'
local c_blue='\e[0;34m'
local c_cyan='\e[0;36m'
local c_reset='\e[0m'
# If root change color of prompt
if [[ $(id -u) == 0 ]]
then
local c_blue='\e[0;31m'
local c_gray='\e[00;30m'
fi
# > Connectbar Down
# Format:
# (newline)(bright colors)(connectbar down)
PS1="\n${c_gray}"
PS1+="$CONNECTBAR_DOWN"
# > Username
# Format:
# (bracket open)(username)(bracket close)(splitbar)
PS1+="[${c_blue}\u${c_gray}]"
PS1+="$SPLITBAR"
# > Jobs
# Format:
# (bracket open)(jobs)(bracket close)(splitbar)
PS1+="[${c_blue}\j${c_gray}]"
# > Exit Status
# Format:
# (bracket open)(last exit status)(bracket close)(splitbar)
PS1+="[${c_blue}${EXIT}${c_gray}]"
PS1+="$SPLITBAR"
# > Time
# Format:
# (bracket open)(time)(bracket close)(newline)(connectbar up)
PS1+="[${c_blue}\D{%H:%M:%S}${c_gray}]\n"
PS1+="$CONNECTBAR_UP"
# > Working Directory
# Format:
# (bracket open)(working directory)(bracket close)(newline)
PS1+="[${c_blue}\w${c_gray}]\n"
# > Arrow
# NOTE: Color must be escaped with '\[\]' to fix the text overflow bug!
# Format:
# (arrow)(color reset)
PS1+="$ARROW \[\e[0m\]"
}
PROMPT_COMMAND='compile_prompt'
fi
The xterm prompt was lifted from the nord color theme, with some changes.
The chances are you do not want to do it the way that I have
Last edited by pm_a_cup_of_tea; 02-11-2022 at 08:56 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.