LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE
User Name
Password
SUSE / openSUSE This Forum is for the discussion of Suse Linux.

Notices


Reply
  Search this Thread
Old 07-19-2021, 03:01 PM   #16
desertcat
Member
 
Registered: Apr 2014
Location: Tucson, AZ
Distribution: UNK: (NEW Workstation) AMD 5900X w/64GB; CentOS 7 (Workstation) AMD FX 6300 w/32GB;
Posts: 74

Rep: Reputation: Disabled

Yep, I followed your suggestion and found the forum group. No reply.

In the meantime I've been busy hacking /etc/bash.bashrc to see where in that cluster $#@* to start to look. If I find an area I mark it down and revert it back to its original form. A slow and painful process. I have located a potential candidate area as it took *some* of my hacks, but not all of them, which tells me I am in the right general area.

Tried doing an install zsh, and promptly came within a hair's width of toasting the install yet again. I ending up nuking anything that had zsh in the file name and hacking other things. Somehow it worked and I was at last able to access root again. This zsh is OUT for now so I am back to hacking BASH. I'd truly would like to string the person who developed /etc/bash.bashrc up by their thumbs... or devise some other torturous means to inflict PAIN on them! On the plus side they are not nearly -- but not by much -- as bad as the devils of KDE 5.x I truly would like to reserve a SPECIAL place in HELL for all of them!!

But maybe it is my mood after last night's Migraine Attack. OK it is time to go back to hacking. Hi Ho, Hi Ho, its back to Hacking I will go.

D'Cat
 
Old 07-20-2021, 01:11 AM   #17
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,850
Blog Entries: 1

Rep: Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074
Quote:
Originally Posted by desertcat View Post
I followed your suggestion and found the forum group. No reply.
I found two.
 
Old 07-20-2021, 03:57 AM   #18
desertcat
Member
 
Registered: Apr 2014
Location: Tucson, AZ
Distribution: UNK: (NEW Workstation) AMD 5900X w/64GB; CentOS 7 (Workstation) AMD FX 6300 w/32GB;
Posts: 74

Rep: Reputation: Disabled
A very Quick followup: I [SOLVED] the problem!!! Well sort of... I was actually able to get my Custom BASH Prompt to take. You need to go all the way down to the line that reads:

*)
# With full path on prompt
PS1="${_t}${_u}:\w${_p} "

I simply commented that line out with a #. That way if the Experiment FAILED, it would be an easy fix of simply uncommenting the line out and saving the file.

Having commented the line out I simply cut and pasted my Custom Prompt below it:


[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="\[\033[1;32m\][\[\033[1;33m\]\u\[\033[1;36m\]@\h\[\033[1;31m\]\w\[\033[1;32m\]]\[\033[1;35m\]/>\[\033[1;37m\]"

I then SAVED the file, killed the konsole, then re-started the konsole and up popped custom color BASH prompt!


[cat@leopard~]/>

or

[root@leopard/]/>

So at least in THEORY the problem is [SOLVED] The PROBLEM that now remains is that I did ALL MY EXPERIMENTATION on the file /etc/bash.bashrc you know the file that begins:

"## PLEASE DO NOT CHANGE /etc/bash.bashrc There are chances that your changes
# will be lost during system upgrades.
Instead use /etc/bash.bashrc.local
# for bash or /etc/ksh.kshrc.local for ksh or /etc/zsh.zshrc.local for the
# zsh or /etc/ash.ashrc.local for the plain ash bourne shell for your local
# settings, favourite global aliases, VISUAL and EDITOR variables, etc ...


I left my Custom Prompt in place but commented it out so I can find it once again, but then uncommented out the original script. That way no harm. no foul since the computer will not read the commented out lines anyway.

So NOW all I have to do if figure out all this silliness about using a file called /etc/bash.bashrc.local. Do I simply copy /etc/bash.bashrc => /etc/bash.bashrc.local? If so and I make my changes to the /etc/bash/bashrc.local file how does computer know to go look for that file, and NOT the /etc/bash.bashrc? A down-and-dirty method would be to give openSUSE the finger copy the original file to a backup location, then modify /etc/bash.bashrc then back *that* file up too, then if something happens simply rename or move the backup files back into place.

Hope this helps.

D'Cat

Last edited by desertcat; 07-20-2021 at 04:54 AM. Reason: Bad typing skills posted the reply before I was ready.
 
Old 07-20-2021, 01:00 PM   #19
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,850
Blog Entries: 1

Rep: Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074
The way I remember it, any /etc/*.local file acts as an appendage to it's "mother" file, so all you should need in /etc/bash.bashrc.local is your single prompt line. Any object in it that matches the mother gets ignored, so in your case, it's PS1, which manifests as environment variable $PS1 and a long, kaleidoscopic shell prompt.
 
Old 07-20-2021, 05:25 PM   #20
desertcat
Member
 
Registered: Apr 2014
Location: Tucson, AZ
Distribution: UNK: (NEW Workstation) AMD 5900X w/64GB; CentOS 7 (Workstation) AMD FX 6300 w/32GB;
Posts: 74

Rep: Reputation: Disabled
Ah!! Thanks. I bet that is what the *) in /etc/bash.bashrc does.

My buddy suggested the exact same thing: All I need is the .local file with the Custom Prompt line in it.

Will try "experimenting" along those lines later tonight assuming no Monsoon storms move in triggering a massive Migraine attack, in which case it is off to take my Fiorinal, kill all light, and ride out the Migraine.

One trivia question: 1) I create a file called /etc/bash.bashrc.local and save it. 2) Do I need to chmod it to set permissions to match those in /etc/bash.bashrc or is there any easier way?

I'll keep you posted on my results.

D'Cat
 
Old 07-20-2021, 05:37 PM   #21
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,850
Blog Entries: 1

Rep: Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074
Quote:
Originally Posted by desertcat View Post
One trivia question: 1) I create a file called /etc/bash.bashrc.local and save it. 2) Do I need to chmod it to set permissions to match those in /etc/bash.bashrc or is there any easier way?
I don't believe the system cares what the permissions on /etc/*.local are, as long as they are readable by root:
Code:
# grep RETT /etc/os-release
PRETTY_NAME="openSUSE Leap 15.2"
# ll /etc/*local
-rw-r--r-- 1 root root   46 Sep  7  2017 /etc/adjtime.local
-rw-r--r-- 1 root root 1425 Dec 27  2015 /etc/permissions.local
-rw-r--r-- 1 root root  519 Dec 22  2020 /etc/polkit-default-privs.local
-rw-rw-r-- 1 root root   57 Apr 27  2017 /etc/profile.local
 
Old 07-20-2021, 07:00 PM   #22
desertcat
Member
 
Registered: Apr 2014
Location: Tucson, AZ
Distribution: UNK: (NEW Workstation) AMD 5900X w/64GB; CentOS 7 (Workstation) AMD FX 6300 w/32GB;
Posts: 74

Rep: Reputation: Disabled
Thank you. You have been a GREAT HELP. This has been a nightmare to solve. It is sooooo easy to modify every other distro I have tried, but not openSUSE 15.3 Leap. I'll let you know how this goes,

D'Cat
 
Old 07-20-2021, 07:37 PM   #23
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,850
Blog Entries: 1

Rep: Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074
There is a place on every reply to say thank you using a single mouse click (Yes).
 
Old 07-21-2021, 12:43 AM   #24
desertcat
Member
 
Registered: Apr 2014
Location: Tucson, AZ
Distribution: UNK: (NEW Workstation) AMD 5900X w/64GB; CentOS 7 (Workstation) AMD FX 6300 w/32GB;
Posts: 74

Rep: Reputation: Disabled
Quote:
Originally Posted by mrmazda View Post
I don't believe the system cares what the permissions on /etc/*.local are, as long as they are readable by root:
Code:
# grep RETT /etc/os-release
PRETTY_NAME="openSUSE Leap 15.2"
# ll /etc/*local
-rw-r--r-- 1 root root   46 Sep  7  2017 /etc/adjtime.local
-rw-r--r-- 1 root root 1425 Dec 27  2015 /etc/permissions.local
-rw-r--r-- 1 root root  519 Dec 22  2020 /etc/polkit-default-privs.local
-rw-rw-r-- 1 root root   57 Apr 27  2017 /etc/profile.local
OK, as promised here is the UPDATE:

1) I created a file called /etc/bash.bashrc.local and made sure it was owned by root, and the permissions match yours.
2) I copied my prompt into /etc/bash.bashrc.local, saved it, closed all instances of konsole, then restarted console. I got the familiar white and red prompts. I then commented out the original BASH prompt that appeared in the *) saved, closed konsole and up popped my beautiful prompt.

So you were right about the * command. I noticed that you state, " I don't believe the system cares what the permissions on /etc/*.local. Instead of creating the file /etc/bash.bashrc.local, should I have created the file /etc/*.local? Since the *) comes before the bash command, does it break off when it finds the *) and looks for the file /etc/*.local?? which has the the single line with the custom prompt? We have so far proved the file /etc/bash.bashrc.local will run the prompt so long as the line that appears BELOW the *) which reads:

# With full path on prompt
PS1="${_t}${_u}:\w${_p} " is commented out. If that line is NOT commented out I get the stock White and Red Prompts.

OK it is raining and I have started to have a migraine -- time to do my DRUGS, kill the lights and crawl in bed with the cat and go to SLEEP

D'Cat
 
Old 07-21-2021, 01:31 AM   #25
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,850
Blog Entries: 1

Rep: Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074
I got rid of the red root prompt by commenting 4 lines in bash.bashrc:
Code:
# grep -A6 "prompting for root" bash.bashrc
        # Other prompting for root
        if test "$UID" -eq 0  ; then
#           if test -n "$TERM" -a -t ; then
#               _bred="$(_path tput bold 2> /dev/null; _path tput setaf 1 2> /dev/null)"
#               _sgr0="$(_path tput sgr0 2> /dev/null)"
#           fi
            # Colored root prompt (see bugzilla #144620)
I've only given it a cursory test so far.

It might be worth a read of comment #25 and thereabouts in that bug.
 
Old 07-21-2021, 03:21 PM   #26
desertcat
Member
 
Registered: Apr 2014
Location: Tucson, AZ
Distribution: UNK: (NEW Workstation) AMD 5900X w/64GB; CentOS 7 (Workstation) AMD FX 6300 w/32GB;
Posts: 74

Rep: Reputation: Disabled
Quote:
Originally Posted by mrmazda View Post
I got rid of the red root prompt by commenting 4 lines in bash.bashrc:
Code:
# grep -A6 "prompting for root" bash.bashrc
        # Other prompting for root
        if test "$UID" -eq 0  ; then
#           if test -n "$TERM" -a -t ; then
#               _bred="$(_path tput bold 2> /dev/null; _path tput setaf 1 2> /dev/null)"
#               _sgr0="$(_path tput sgr0 2> /dev/null)"
#           fi
            # Colored root prompt (see bugzilla #144620)
I've only given it a cursory test so far.

It might be worth a read of comment #25 and thereabouts in that bug.
Hummmmm VERY INTERESTING! A few lines below that you will see two lines that say _p="#" if you substitute say something like /> your prompt will now reflect /> rather than #.

For me I ended up cutting my teeth on IBM and MS_DOS and the > symbol became second nature. Though I have been hacking on Linux for ~ 21 + years I never did get use to $ and #, which lead me to barely touch PS1, to writing entire Custom Prompts both in BASH and ZSH using ACSII text colors. The question is did you blow up /etc/bash.bashrc which admonishes you to "PLEASE DO NOT CHANGE /etc/bash.bashrc..." ? BTW you can change the WHITE Prompt ~> by adding the ASCII sequence to something like _p="\[\033[1;36m\]/> " I think now changes that whole line into CYAN. By commenting out a SINGLE line and from that file and creating the file /etc/bash.bashrc.local that contains the Custom Prompt. Ideally IF you can create a file called /etc/*.local as /etc/bash.bashrc file is being read down from the top, when it reaches the *) line it then is diverted to /etc/*.local where the Custom Prompt can be found. For the time being just in case commenting OUT a line and is considered a major change, it is a good plan to have a copy of /etc/bash.bashrc original and a copy of your /etc/bash.bashrc.local stored some place just in case you get nuked, then you can copy back the original and modified files.

I've got to say we are hacking this horrible /etc/bash.bashrc into something reasonable.

D'Cat
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
change PS1 environment variable from c program sagsriv Linux - Newbie 4 03-10-2008 01:39 PM
PS1 environment variable linuxjamil Linux - Networking 1 06-16-2007 11:51 PM
Prompt not hard returning after PS1 variable change? SlowCoder Linux - Newbie 5 05-01-2007 09:16 PM
Setting PS1 variable for KDE Konsole shell (RH9) robertmarkbram Linux - Software 4 10-14-2003 07:38 PM
setting the PS1 enviroment variable in xterm qanopus Linux - General 2 04-29-2003 08:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE

All times are GMT -5. The time now is 11:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration