|
OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
|||
Editing $PATH
Another question which reveals the depth of my ignorance:
rcvstore is an executable file located in /usr/local/libexec/nmh. Why then if I edit my $PATH in ~/.kshrc and add /usr/local/lib/exec/nmh do I not see it? I am editing my ~/.fdm.conf file and I'd like to be able to just write rcvstore +folder instead of /usr/local/libexec/rcstore +folder 25 times. Thank you |
|
|||
1. Yes, that was a typo.
2. Sorry, jggimi. I have no idea what you are trying to tell me. The ksh(1) man page mentions the ~/.kshrc file multiple times. I realize I'm being dense but it sounds to me like you're saying ~/.kshrc shouldn't exist which can't be what you're telling me. |
|
||||
https://man.openbsd.org/ksh#ENV
^ Is that parameter set? EDIT: anyway the interactive shell configuration file is not the best place to set PATH because it will be read every time a shell is opened and if you're adding directories PATH will become more and more bloated each time. Use ~/.profile (for console logins) or ~/.xsession (for xenodm) instead.
__________________
Are you infected with Wetiko? Last edited by Head_on_a_Stick; 19th February 2022 at 02:46 PM. |
|
|||
To say I am confused would be an under statement.
Yes, in my ~/.kshrc the first line is . /etc/ksh.kshrc If I understand you correctly, you're saying that lines such as export PATH, export editor, etc should go in ~/.profile and not ~/.kshrc? 1) I still don't understand jggimi telling me ~/.kshrc shouldn't exist (which can't be what he's telling me). This is my PATH entry: export PATH=$PATH:$HOME/bin:$HOME/.local/bin 2) I don't understand if my PATH is: export PATH=$PATH:$Home/bin:$HOME/.local/bin why if I do echo $PATH, the $HOME entries show up twice: PATH=$PATH:$HOME/bin:$HOME/.local/bin:$HOME/bin:$HOME/.local/bin And I still have my original question: how can I make it so I don't have to type out the entire /usr/local/libexec/nmh/rcvstore? Sorry to be so dense. I do appreciate the help. Thanks |
|
||||
Quote:
~/.kshrc (or more accurately "$ENV") is the interactive (non-login) shell configuration file so it is only read when an interactive shell is started. Some parameters may need to be set for the whole login session rather then just for the shell and adding them to "$ENV" would not achieve that. ~/.profile (or ~/.xsession for xenodm sessions) is the appropriate login (non-interactive) shell configuration file for those parameters. See also https://unix.stackexchange.com/quest...on-login-shell Quote:
Quote:
That can be prevented by exporting PATH from the login (non-interactive) shell configuration file. Such a file is only read once per session so PATH won't grow. If you insist on exporting PATH from the interactive (non-login) configuration file you can use something like this to only add the directories to PATH if they are not already present: Code:
function prepend_path { case ":$PATH:" in *:"$1":*) ;; *) PATH="$1":"${PATH:+$PATH}" esac } prepend_path "$HOME"/bin prepend_path "$HOME"/.local/bin unset -f prepend_path Quote:
Code:
PATH="$HOME"/bin:"$HOME"/.local/bin:/usr/local/libexec/nmh/rcvstore:"$PATH" export PATH
__________________
Are you infected with Wetiko? Last edited by Head_on_a_Stick; 19th February 2022 at 05:44 PM. Reason: removed superfluous curly brackets from "$1" |
|
|||
My ~/.kshrc after editing:
Code:
. /etc/ksh.kshrc . /home/slaurel/.aliases PS1='${PWD}$ ' Code:
# $OpenBSD: dot.profile,v 1.5 2018/02/02 02:29:54 yasuoka Exp $ # # sh/ksh initialization ENV=$HOME/.kshrc . /etc/ksh.kshrc . /home/slaurel/.aliases export EXA_COLORS="di=34:ex=31:uu=34:gu=36:sn=31:sb=36:*.pdf=30;43:*.html=30;43:*.webm=34;43:*.mkv=34;43" PATH=$HOME/bin:$HOME/.local/bin:/usr/local/libexec/nmh/rcvstore:"$PATH" export COLORTERM=truecolor export LC_CTYPE=en_US.UTF-8 export BROWSER=firefox export MPD_HOST="localhost" export MPD_PORT="6600" export EDITOR=vi export FCEDIT=$EDITOR export PAGER=less export MANPAGER=less export HISTFILE=$HOME/.ksh_history export LEDGER_FILE=$HOME/Accounts.dat export LEDGER_FILE=$HOME/ledger.dat #export CLICOLOR=1 #export LSCOLORS="exfxbxdxcxegedabagacad" Code:
/home/slaurel$ echo $PATH /home/slaurel/bin:/home/slaurel/.local/bin:/usr/local/libexec/nmh/rcvstore:/home/slaurel/bin:/home/slaurel/.local/bin:/usr/local/libexec/nmh/rcvstore:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin /home/slaurel$ I am really sorry to be such a pain but what am I doing wrong? |
|
||||
Did you log out & back in again before checking PATH?
Are you using xenodm? If so then please share the content of ~/.xsession Note that you haven't exported PATH in ~/.profile. I prefer to set the values first then export them separately (as per POSIX) but ksh supports doing both in the same line. Sounds like EDITOR has not been set. Again, be sure to log out & back in again after adding that parameter to ~/.profile (or ~/.xsession). Use env(1) to list the current environmental parameters. This will restore vi-like command history browsing in the current session: Code:
set -o vi Code:
PS1='\w\$ '
__________________
Are you infected with Wetiko? Last edited by Head_on_a_Stick; 19th February 2022 at 07:57 PM. |
|
|||
Before anything, I would like to thank you again for all the time you are taking trying to get me to understand this.
I have always preferred to start X from an ~/.xinitrc file: Code:
#!/bin/sh # $OpenBSD: xinitrc.cpp,v 1.13 2015/10/17 08:25:11 matthieu Exp $ # # #xsetroot -fg \#6f6f6f -bg \#bfbfbf -bitmap /usr/X11R6/include/X11/bitmaps/root_weave & xset b off # To disable screen blanking: xset s off xset s on +dpms xrandr --dpi 96 sndioctl output.level=+0.1 & unclutter -root -idle 2 -noevents & # xautolock -time 10 -locker slock -detectsleep & xset fp default for font in /usr/local/share/fonts/* ; do xset fp+ $font done xset fp rehash xinput set-prop "/dev/wsmouse" "WS Pointer Wheel Emulation" 1 xinput set-prop "/dev/wsmouse" "WS Pointer Wheel Emulation Button" 2 xinput set-prop "/dev/wsmouse" "WS Pointer Wheel Emulation Axes" 6 7 4 5 # xinput set-button-map 4 1 1 3 setxkbmap -option ctrl:nocaps # Make caps local a control key userresources=$HOME/.Xresources usermodmap=$HOME/.Xmodmap sysresources=/etc/X11/xinit/.Xresources sysmodmap=/etc/X11/xinit/.Xmodmap # merge in defaults and keymaps if [ -f $sysresources ]; then xrdb -merge $sysresources fi if [ -f $sysmodmap ]; then xmodmap $sysmodmap fi if [ -f "$userresources" ]; then xrdb -merge "$userresources" fi if [ -f "$usermodmap" ]; then xmodmap "$usermodmap" fi # if we have private ssh key(s), start ssh-agent and add the key(s) id1=$HOME/.ssh/identity id2=$HOME/.ssh/id_dsa id3=$HOME/.ssh/id_rsa id4=$HOME/.ssh/id_ecdsa id5=$HOME/.ssh/id_ed25519 if [ -z "$SSH_AGENT_PID" ]; then if [ -x /usr/bin/ssh-agent ] && [ -f $id1 -o -f $id2 -o -f $id3 -o -f $id4 -o -f $id5 ]; then eval `ssh-agent -s` ssh-add < /dev/null fi fi # If using xintrc to login: if [ -x ${PREFIX}/bin/dbus-launch -a -z "${DBUS_SESSION_BUS_ADDRESS}" ]; then eval `dbus-launch --sh-syntax --exit-with-session` fi # If using xenodm to login use: #if [ -x ${PREFIX}/bin/dbus-launch -a -z "${DBUS_SESSION_BUS_ADDRESS}" ]; then # eval `dbus-launch --sh-syntax --exit-with-x11` #fi # start some nice programs #mpd ~/.mpd/mpd.conf # tint2 & #emacs --bg-daemon #xclock -d -bg navy -fg orange -geometry -1-1 & cwm if [ "$SSH_AGENT_PID" ]; then ssh-add -D < /dev/null eval `ssh-agent -s -k` fi Code:
: . /etc/ksh.kshrc set -o vi alias less='less -IgMw -x2' alias ls='exa --group-directories-first' alias la='ls -aF' alias ll='ls -lhF' alias df='df -h' #alias du='du -s * | sort -rnk 1' alias cp='cp -i' alias su='su -l' alias reboot='doas shutdown -r now' alias shutdown='doas shutdown -p now' PS1='\w\$ ' Code:
: # $OpenBSD: dot.profile,v 1.5 2018/02/02 02:29:54 yasuoka Exp $ # # sh/ksh initialization ENV=$HOME/.kshrc export EXA_COLORS="di=34:ex=31:uu=34:gu=36:sn=31:sb=36:*.pdf=30;43:*.html=30;43:*.webm=34;43:*.mkv=34;43" export PATH=$PATH:$HOME/bin:$HOME/.local/bin:/usr/local/libexec/nmh export COLORTERM=truecolor export LC_CTYPE=en_US.UTF-8 export BROWSER=firefox export MPD_HOST="localhost" export MPD_PORT="6600" export EDITOR=vi export FCEDIT=$EDITOR export PAGER=less export MANPAGER=less export HISTFILE=$HOME/.ksh_history export LEDGER_FILE=$HOME/Accounts.dat export LEDGER_FILE=$HOME/ledger.dat #export CLICOLOR=1 #export LSCOLORS="exfxbxdxcxegedabagacad" Code:
~$ echo $PATH /home/slaurel/bin:/home/slaurel/.local/bin:/usr/local/libexec/nmh:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/home/slaurel/bin:/home/slaurel/.local/bin:/usr/local/libexec/nmh ~$ Thanks |
|
||||
I think this is because of the way you're setting PATH in ~/.profile. The parameter appears to be applied twice but I don't know why.
Try the method used in /etc/skel/.profile (ie, the original version of that file): Code:
PATH=$HOME/bin:$HOME/.local/bin:/usr/local/libexec/nmh:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games export PATH
__________________
Are you infected with Wetiko? |
|
|||
As you suggested, following the example in /etc/skel/.profile works:
Code:
~$ echo $PATH /home/slaurel/bin:/home/slaurel/.local/bin:/usr/local/libexec/nmh:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games ~$ Thank you very much for your time and effort. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Box Wont Boot After Editing /etc/hostname.athn0 | EverydayDiesel | OpenBSD General | 8 | 10th January 2013 02:31 PM |
CFEngine 3.4 adds XML editing and VirtualBox support | J65nko | News | 0 | 29th November 2012 02:13 PM |
add to path | carpman | FreeBSD General | 4 | 19th August 2010 06:13 AM |
Non-root user editing automatically mounted smb share | tad1214 | FreeBSD General | 8 | 8th July 2008 02:28 AM |