Blame
Date:
Wed Feb 1 05:00:29 2023 UTC
Message:
Daily backup
01
2023-01-22
jrmu
version=pmwiki-2.2.130 ordered=1 urlencoded=1
02
2023-01-22
jrmu
agent=Mozilla/5.0 (X11; OpenBSD amd64; rv:82.0) Gecko/20100101 Firefox/82.0
03
2023-01-22
jrmu
author=jrmu
04
2023-01-22
jrmu
charset=UTF-8
05
2023-01-22
jrmu
csum=
06
2023-01-22
jrmu
ctime=1623238281
07
2023-01-22
jrmu
host=125.231.25.80
08
2023-01-22
jrmu
name=Ksh.Bash
09
2023-01-22
jrmu
rev=1
10
2023-01-22
jrmu
targets=
11
2023-01-22
jrmu
text=(:title ksh for bash users:)%0a%0a!! What are my options?%0a%0aYou can switch to BASH if you are very familiar with BASH, however it is '''recommended''' to stick with KSH as KSH is more POSIX compliant.%0a%0aThat said, you '''can''' also make KSH behave more like BASH, which is more preferable than switching over to BASH.%0a%0a!! I want to switch to bash%0a%0aIf you prefer bash,%0a%0a[@%0a$ chsh -s /usr/local/bin/bash username%0a@]%0a%0aReplace @@username@@ with your real username.%0a%0aLog out and log back in to make your default shell bash.%0a%0a!! How can I make ksh behave like bash?%0a%0aEdit your ~/.profile to declare the HOSTNAME variable, as the actual hostname is stored within /etc/myname. Then, you want to make sure that your ~/.profile reads its environment from your ~/.kshrc. So your ~/.profile should look something like this,%0a%0a[@%0a# $OpenBSD: dot.profile,v 1.5 2018/02/02 02:29:54 yasuoka Exp $%0a#%0a# sh/ksh initialization%0a%0aPATH=$HOME/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/games%0aexport PATH HOME TERM%0a%0aHOSTNAME="$(cat /etc/myname)"%0aENV="$HOME/.kshrc"; export ENV%0a@]%0a%0aOnce you have that down, it is now time to edit your ~/.kshrc file.%0a%0a[@%0afunction _cd {%0a \cd "$@"%0a PS1=$(%0a print -n "$LOGNAME@$HOSTNAME:"%0a if [[ "${PWD#$HOME}" != "$PWD" ]]; then%0a print -n "~${PWD#$HOME}"%0a else%0a print -n "$PWD"%0a fi%0a print "$ "%0a )%0a}%0a%0aalias cd=_cd%0a%0acd "$PWD"%0a@]%0a%0a[[https://stackoverflow.com/questions/1171663/how-to-custom-display-prompt-in-kornshell-to-show-hostname-and-current-directory/8468165#8468165|Source: Stack Overflow]]%0a%0a!! Implement command history%0a%0a"For the arrow keys, you can put this into your the .kshrc file [(pdksh and mksh both use .mkshrc, not .kshrc)] in your home directory:%0a%0a[@%0aset -o emacs%0aalias __A=`echo "\020"` # up arrow = ^p = back a command%0aalias __B=`echo "\016"` # down arrow = ^n = down a command%0aalias __C=`echo "\006"` # right arrow = ^f = forward a character%0aalias __D=`echo "\002"` # left arrow = ^b = back a character%0aalias __H=`echo "\001"` # home = ^a = start of line%0aalias __Y=`echo "\005"` # end = ^e = end of line%0a@]%0a%0a[[https://unix.stackexchange.com/a/388258|Source: Stack Exchange]]%0a%0a!! How do I change my password?%0a%0a[@%0a$ passwd%0aChanging password for $user%0aOld password:%0aNew password:%0aRetype new password:%0a$%0a@]
12
2023-01-22
jrmu
time=1623238281
13
2023-01-22
jrmu
title=ksh for bash users
14
2023-01-22
jrmu
author:1623238281=jrmu
15
2023-01-22
jrmu
diff:1623238281:1623238281:=1,85d0%0a%3c (:title ksh for bash users:)%0a%3c %0a%3c !! What are my options?%0a%3c %0a%3c You can switch to BASH if you are very familiar with BASH, however it is '''recommended''' to stick with KSH as KSH is more POSIX compliant.%0a%3c %0a%3c That said, you '''can''' also make KSH behave more like BASH, which is more preferable than switching over to BASH.%0a%3c %0a%3c !! I want to switch to bash%0a%3c %0a%3c If you prefer bash,%0a%3c %0a%3c [@%0a%3c $ chsh -s /usr/local/bin/bash username%0a%3c @]%0a%3c %0a%3c Replace @@username@@ with your real username.%0a%3c %0a%3c Log out and log back in to make your default shell bash.%0a%3c %0a%3c !! How can I make ksh behave like bash?%0a%3c %0a%3c Edit your ~/.profile to declare the HOSTNAME variable, as the actual hostname is stored within /etc/myname. Then, you want to make sure that your ~/.profile reads its environment from your ~/.kshrc. So your ~/.profile should look something like this,%0a%3c %0a%3c [@%0a%3c # $OpenBSD: dot.profile,v 1.5 2018/02/02 02:29:54 yasuoka Exp $%0a%3c #%0a%3c # sh/ksh initialization%0a%3c %0a%3c PATH=$HOME/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/games%0a%3c export PATH HOME TERM%0a%3c %0a%3c HOSTNAME="$(cat /etc/myname)"%0a%3c ENV="$HOME/.kshrc"; export ENV%0a%3c @]%0a%3c %0a%3c Once you have that down, it is now time to edit your ~/.kshrc file.%0a%3c %0a%3c [@%0a%3c function _cd {%0a%3c \cd "$@"%0a%3c PS1=$(%0a%3c print -n "$LOGNAME@$HOSTNAME:"%0a%3c if [[ "${PWD#$HOME}" != "$PWD" ]]; then%0a%3c print -n "~${PWD#$HOME}"%0a%3c else%0a%3c print -n "$PWD"%0a%3c fi%0a%3c print "$ "%0a%3c )%0a%3c }%0a%3c %0a%3c alias cd=_cd%0a%3c %0a%3c cd "$PWD"%0a%3c @]%0a%3c %0a%3c [[https://stackoverflow.com/questions/1171663/how-to-custom-display-prompt-in-kornshell-to-show-hostname-and-current-directory/8468165#8468165|Source: Stack Overflow]]%0a%3c %0a%3c !! Implement command history%0a%3c %0a%3c "For the arrow keys, you can put this into your the .kshrc file [(pdksh and mksh both use .mkshrc, not .kshrc)] in your home directory:%0a%3c %0a%3c [@%0a%3c set -o emacs%0a%3c alias __A=`echo "\020"` # up arrow = ^p = back a command%0a%3c alias __B=`echo "\016"` # down arrow = ^n = down a command%0a%3c alias __C=`echo "\006"` # right arrow = ^f = forward a character%0a%3c alias __D=`echo "\002"` # left arrow = ^b = back a character%0a%3c alias __H=`echo "\001"` # home = ^a = start of line%0a%3c alias __Y=`echo "\005"` # end = ^e = end of line%0a%3c @]%0a%3c %0a%3c [[https://unix.stackexchange.com/a/388258|Source: Stack Exchange]]%0a%3c %0a%3c !! How do I change my password?%0a%3c %0a%3c [@%0a%3c $ passwd%0a%3c Changing password for $user%0a%3c Old password:%0a%3c New password:%0a%3c Retype new password:%0a%3c $%0a%3c @]%0a\ No newline at end of file%0a
16
2023-01-22
jrmu
host:1623238281=125.231.25.80
IRCNow