Kshrc custom prompt will not work


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Kshrc custom prompt will not work
# 8  
Old 10-28-2019
Quote:
Originally Posted by MadeInGermany
Hmm, I suggest to consult the man page.
Code:
man ksh

And /search for ENV
What does it say?
The Man page says:
Code:
ENV    If this variable is set, then parameter expansion, command substitution, and arithmetic substitution are performed on the value to generate the pathname of the script that will be exe
                     cuted  when  the shell is invoked interactively (see Invocation below).  This file is typically used for alias and function definitions.  The default value is $HOME/.kshrc.  On systems
                     that support a system wide  /etc/ksh.kshrc initialization file, if the filename generated by the expansion of ENV begins with /./ or ././ the system wide initialization file  will  not
                     be executed.

When I run echo $ENV It outputs /usr/share/Modules/init/profile.sh which says:
Code:
# get current shell name by querying shell variables or looking at parent
# process name
if [ -n "${BASH:-}" ]; then
   shell=${BASH##*/}
elif [ -n "${ZSH_NAME:-}" ]; then
   shell=$ZSH_NAME
else
   shell=$(/usr/bin/basename $(/usr/bin/ps -p $$ -ocomm=))
fi

if [ -f /usr/share/Modules/init/$shell ]; then
   . /usr/share/Modules/init/$shell
else
   . /usr/share/Modules/init/sh
fi

# 9  
Old 10-28-2019
I'm not that familiar with the environment-modules package (never run it myself), but I would have expected that /usr/share/Modules/init/ksh should end up sourcing $HOME/.kshrc if you have one.
# 10  
Old 10-28-2019
Quote:
Originally Posted by Chubler_XL
I'm not that familiar with the environment-modules package (never run it myself), but I would have expected that /usr/share/Modules/init/ksh should end up sourcing $HOME/.kshrc if you have one.
So I added
Code:
. $HOME/.kshrc;

to the bottom of the file and it fixed it. Thank you all for helping me with this error.
# 11  
Old 10-28-2019
Can I recommend [ -f "$HOME"/.kshrc ] && . "$HOME"/.kshrc to avoid the
Code:
ksh: .: /home/testuser/.kshrc: cannot open [No such file or directory]

error when ksh is executed by a user without a $HOME/.kshrc file
# 12  
Old 10-29-2019
There must be a bug in that version of environment-modules.
Are there any results of
Code:
grep -w ENV /etc/profiles.d/modules*

where ENV is assigned the /usr/share/Modules/init/ ?
Then this mistake should be commented out/disabled.
(And the generally not good previous workaround can be backed out.)
# 13  
Old 10-29-2019
I agree that something is not quite right with the environment-modules package in the OP system.

I believe removing that assignment of ENV will stop environment-modules working at all
and may have a more negative impact on the system as a whole than the workaround currently used.

Depending on criticality of the system. I would consider reinstalling the environment-modules package, or if it's features are not required. removing it.
# 14  
Old 11-02-2019
So, I just update from Fedora 30 to Fedora 31, and this seems to have fixed the problem because echo $ENV now outputs /home/zoomer/.kshrc. I believe that this was a bug for Fedora 30. Thank you to everyone that help me get the temporary fix.
This User Gave Thanks to zoomer For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

How to make this command work wihtout password prompt?

Hi, I am trying to run this command to connect to each server without being prompted for the password. How can I do this in Linux redhat 7.2: for HOST in $VIPS; do su - Myadminid -c "ssh -o ConnectTimeout=10 $HOST 'date; hostname; pkill -9 -f -u Myadminid xx00 ; ps -ef |grep Myadminid'" ... (7 Replies)
Discussion started by: mrn6430
7 Replies

2. Red Hat

RHEL6 customizing prompt do not work

Hi, I'm trying to customize the ksh prompt for users on a RHEL 6.6 system for having user@host pwd : $ and user@host pwd # in red color for root. I think it's possible but i do not even succeded for a non root user : I added in my ~/.kshrc : PS1="Hello : " and it works but when i... (4 Replies)
Discussion started by: Fundix
4 Replies

3. Shell Programming and Scripting

Color prompt with file numbers does not work anymore

I have used this color prompt on my servers for long time, in file ~\.bashrc Black="\" Dark="\" Blue="\" LBlue="\" Green="\" LGreen="\" Cyan="\" LCyan="\" Red="\" LRed="\" Purple="\" LPurple="\" Brown="\" Yellow="\" LGray="\" White="\" Reset="\" PS1="$Yellow\u@\h $LBlue\w... (4 Replies)
Discussion started by: Jotne
4 Replies

4. Shell Programming and Scripting

Change / Setup bash custom prompt (PS1)

I am trying to create my custom prompt and I have almost succeeded. Right now I have PS1='\n\\$\ ' What I have not figured out is how to make the directories bold when I'm using commands ls or ls -la. Any idea how to do it??? Many thanx. (2 Replies)
Discussion started by: emailkia
2 Replies

5. Shell Programming and Scripting

Ksh93 vs. Pdksh88: Custom PS1 prompt not working

Greetings! I have to work with a NFS user id between two hosts: A running Ksh 93 and B running pdksh 88. My problem has to do with the custom prompt I created on A: it works like a charm and display colors: PS1="$'\E But I switch over to B, it all goes to hell (private info... (4 Replies)
Discussion started by: alan
4 Replies

6. AIX

"/" doesn't work on command prompt for searching commands last typed

When I use "/" to look for a particular command that I typed in the current session it says D02:-/home/user1/temp> /job ksh: /job: not found. D02:-/home/user1/temp> previously it used to fetch all the commands which had job in it.. for example subjob, endjob, joblist etc... may I... (7 Replies)
Discussion started by: meetzap
7 Replies

7. AIX

Custom AIX Prompt

In my .profile, my prompt is set like this: set -o vi PS1=`logname`@`hostname -s`:'$PWD>' Is there a way to show what the history number would be of the command I'm typing in the prompt? For example, I frequently run commands then run 'history' to pull up the history number of a command... (2 Replies)
Discussion started by: ptrotter
2 Replies

8. Shell Programming and Scripting

.kshrc is not executing

Hi, I am facing two problems in my environment. Anyone can help on this? Thanks in advance. Problem 1 --------- When i login into my new unix system, only the .profile is executing. .kshrc is not executing. But my default shell is .ksh Any setup to be changed ? Problem 2... (7 Replies)
Discussion started by: senthil_is
7 Replies

9. UNIX for Dummies Questions & Answers

Getting current work directory in Command Prompt

How to get the current working directory as part of the command prompt? Every time I chage the folder, my command prompt path shoud change. I am using Korn Shell. Any help is greatly appreciated. (3 Replies)
Discussion started by: MeganP
3 Replies

10. Shell Programming and Scripting

kshrc

An odd problem using .kshrc, if I run with this in my home login directory it works fine other than if I use 'man', where each word of the manual entry is on a seperate line ?. I'm using AIX 5.3 (it worked fine on 5.2). Anyone seen this before ? (3 Replies)
Discussion started by: gefa
3 Replies
Login or Register to Ask a Question