Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Kshrc custom prompt will not work Post 303040357 by zoomer on Sunday 27th of October 2019 11:16:49 AM
Old 10-27-2019
Kshrc custom prompt will not work

So Yesterday I switched from Solus Linux to Fedora Linux 30, but I forgot to backup some of my dotfiles including kshrc. I am fairly new to Korn shell and do not know it well, but through memory I was able to at least get this. I did use code from several different source to recreate it. The only problem is that my prompt does not change. When I was on Solus Linux I used the korn shell source from github and now I am using Korn Shell from the copr latest ksh repo for Fedora. If anyone could help me out with my config that would be great.
The way the prompt should look like is: zoomer@fedora:[/u/l/bin]:$
Code:
## Arrow Key Functions
set -o emacs
alias __A=$(print '\0020') # ^P = up = previous command
alias __B=$(print '\0016') # ^N = down = next command
alias __C=$(print '\0006') # ^F = right = forward a character
alias __D=$(print '\0002') # ^B = left = back a character
alias __H=$(print '\0001') # ^A = home = beginning of line

## Collapsed Directory
_collapsed_pwd() {
  echo $(pwd | perl -pe '
   BEGIN {
      binmode STDIN,  ":encoding(UTF-8)";
      binmode STDOUT, ":encoding(UTF-8)";
   }; s|^$ENV{HOME}|~|g; s|/([^/.])[^/]*(?=/)|/$1|g; s|/\.([^/])[^/]*(?=/)|/.$1|g
')
}

## Reset to normal: \033[0m
NORM="\033[0m"

## Colors:
BLACK="\033[0;30m"
GRAY="\033[1;30m"
RED="\033[0;31m"
LRED="\033[1;31m"
GREEN="\033[0;32m"
LGREEN="\033[1;32m"
YELLOW="\033[0;33m"
LYELLOW="\033[1;33m"
BLUE="\033[0;34m"
LBLUE="\033[1;34m"
PURPLE="\033[0;35m"
PINK="\033[1;35m"
CYAN="\033[0;36m"
LCYAN="\033[1;36m"
LGRAY="\033[0;37m"
WHITE="\033[1;37m"

## Backgrounds
BLACKB="\033[0;40m"
REDB="\033[0;41m"
GREENB="\033[0;42m"
YELLOWB="\033[0;43m"
BLUEB="\033[0;44m"
PURPLEB="\033[0;45m"
CYANB="\033[0;46m"
GREYB="\033[0;47m"

## Attributes:
UNDERLINE="\033[4m"
BOLD="\033[1m"
INVERT="\033[7m"

## Cursor movements
CUR_UP="\033[1A"
CUR_DN="\033[1B"
CUR_LEFT="\033[1D"
CUR_RIGHT="\033[1C"

## Start of display (top left)
SOD="\033[1;1f"

PS1="$(echo "${GREEN}${USER}${NORM}@${HOSTNAME}:[${GREEN}$(_collapsed_pwd)${NORM}:$")"

 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
colormake(1)						      General Commands Manual						      colormake(1)

NAME
colormake - color wrapper for make(1) SYNOPSIS
colormake [ --short ] ... DESCRIPTION
colormake acts as a wrapper around make(1) to ease reading the output by colorizing it. OPTIONS
The --short option instructs colormake to truncate lines so they do not wrap. All other options will be passed unmodified to make(1). USAGE
To change a makefile to use colormake, you may change the path at the top which normally reads #!/usr/bin/make to #!/usr/bin/colormake. Alternately, you may type colormake whenever you would normally type make when compiling programs. Colormake is also available using the alternate names which enable piping through less (clmake), truncated output so lines do not wrap (colormake-short), or both (clmake-short). FILES
The configuration files are Perl scripts included by colormake.pl. The defaults values are (from colormake.pl itself): # Some useful color codes, see end of file for more. # $col_black = "33[30m"; $col_red = "33[31m"; $col_green = "33[32m"; $col_yellow = "33[33m"; $col_blue = "33[34m"; $col_magenta = "33[35m"; $col_cyan = "33[36m"; $col_ltgray = "33[37m"; $col_norm = "33[00m"; $col_background = "33[07m"; $col_brighten = "33[01m"; $col_underline = "33[04m"; $col_blink = "33[05m"; # Customize colors here... # $col_default = $col_ltgray; $col_gcc = $col_magenta . $col_brighten; $col_make = $col_cyan; $col_filename = $col_yellow; $col_linenum = $col_cyan; $col_trace = $col_yellow; $col_warning = $col_green; $tag_error = ""; $col_error = $tag_error . $col_yellow . $col_brighten; $error_highlight = $col_brighten; For use with gnome-terminal I have the following configuration in my $HOME/.colormakerc file: $col_default = $col_black; $col_gcc = $col_magenta; $col_filename = $col_blue; $col_linenum = $col_cyan; $col_error = $tag_error . $col_red . $col_brighten; /usr/share/colormake/colormake.rc System-wide configuration file for colormake. $HOME/.colormakerc Personal configuration file for colormake. HISTORY
/usr/bin/colormake was formerly named /usr/bin/cmake but had to be renamed because of a name clash. AUTHORS
Bjarni R. Einarsson is the author of colormake. This manual page was written for the Debian GNU/Linux distribution because the original program does not have a manual page. This manual page was written by Joe Wreschnig <piman@sacredchao.net> and updated by Ludovic Rousseau <rousseau@debian.org>, for the Debian GNU/Linux system (but may be used by others). SEE ALSO
make(1), clmake(1) July 2nd, 2001 colormake(1)
All times are GMT -4. The time now is 03:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy