diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-12-17 17:46:15 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-12-17 17:53:22 +1300 |
commit | 700ac112a3dd2041de5fc2a6abd3781103c704a8 (patch) | |
tree | 91c0a928697f6ddef11312b95d391b5c9afbb5e4 | |
parent | Resolve an issue with find(1) compatibility (diff) | |
download | dotfiles-700ac112a3dd2041de5fc2a6abd3781103c704a8.tar.gz dotfiles-700ac112a3dd2041de5fc2a6abd3781103c704a8.zip |
Rename all pdksh stuff to ksh
As part of a foray into more active use of ksh and derivatives.
-rw-r--r-- | Makefile | 24 | ||||
-rw-r--r-- | README.markdown | 12 | ||||
-rwxr-xr-x | check/ksh | 6 | ||||
-rwxr-xr-x | check/pdksh | 6 | ||||
-rw-r--r-- | ksh/kshrc (renamed from pdksh/pdkshrc) | 8 | ||||
-rw-r--r-- | ksh/kshrc.d/prompt.ksh (renamed from pdksh/pdkshrc.d/prompt.pdksh) | 10 | ||||
-rwxr-xr-x | lint/ksh | 2 | ||||
-rwxr-xr-x | lint/pdksh | 2 | ||||
-rw-r--r-- | sh/shrc.d/ksh.sh | 10 | ||||
-rw-r--r-- | vim/after/ftdetect/sh.vim | 2 |
10 files changed, 43 insertions, 39 deletions
@@ -23,7 +23,7 @@ install-ncmcpp \ install-newsbeuter \ install-mysql \ - install-pdksh \ + install-ksh \ install-perlcritic \ install-perltidy \ install-psql \ @@ -46,7 +46,7 @@ check-bash \ check-bin \ check-games \ - check-pdksh \ + check-ksh \ check-sh \ check-urxvt \ check-yash \ @@ -54,7 +54,7 @@ lint-bash \ lint-bin \ lint-games \ - lint-pdksh \ + lint-ksh \ lint-yash \ lint-sh \ lint-urxvt @@ -290,11 +290,11 @@ install-newsbeuter : install-mysql : install -pm 0644 -- mysql/my.cnf "$(HOME)"/.my.cnf -install-pdksh : check-pdksh install-sh +install-ksh : check-ksh install-sh install -m 0755 -d -- \ - "$(HOME)"/.pdkshrc.d - install -pm 0644 -- pdksh/pdkshrc "$(HOME)"/.pdkshrc - install -pm 0644 -- pdksh/pdkshrc.d/* "$(HOME)"/.pdkshrc.d + "$(HOME)"/.kshrc.d + install -pm 0644 -- ksh/kshrc "$(HOME)"/.kshrc + install -pm 0644 -- ksh/kshrc.d/* "$(HOME)"/.kshrc.d install-perlcritic : install -pm 0644 -- perlcritic/perlcriticrc "$(HOME)"/.perlcriticrc @@ -409,8 +409,8 @@ check-games : check-man : check/man -check-pdksh : - check/pdksh +check-ksh : + check/ksh check-sh : check/sh @@ -425,7 +425,7 @@ lint : check \ lint-bash \ lint-bin \ lint-games \ - lint-pdksh \ + lint-ksh \ lint-sh \ lint-urxvt \ lint-yash @@ -439,8 +439,8 @@ lint-bin : lint-games : lint/games -lint-pdksh : - lint/pdksh +lint-ksh : + lint/ksh lint-sh : lint/sh diff --git a/README.markdown b/README.markdown index f4c73817..aa5ce453 100644 --- a/README.markdown +++ b/README.markdown @@ -53,13 +53,12 @@ Configuration is included for: * [GTK+](http://www.gtk.org/) -- GIMP Toolkit, for graphical user interface elements * [i3](https://i3wm.org/) -- Tiling window manager +* [Korn shell](http://www.kornshell.com/) -- Korn shell and its derivatives * [less](https://www.gnu.org/software/less/) -- Terminal pager * [Mutt](http://www.mutt.org/) -- Terminal mail user agent * [`mysql(1)`](http://linux.die.net/man/1/mysql) -- Command-line MySQL client * [Ncmpcpp](https://rybczak.net/ncmpcpp/) -- ncurses music player client * [Newsbeuter](https://www.newsbeuter.org/) -- Terminal RSS/Atom feed reader -* [`pdksh(1)`](http://www.cs.mun.ca/~michael/pdksh/) -- public domain fork - of the Korn shell * [`psql(1)`](http://linux.die.net/man/1/psql) -- Command-line PostgreSQL client * [Perl::Critic](http://perlcritic.com/) -- static source code analysis @@ -254,12 +253,11 @@ I also add completions for my own scripts and functions where useful. The completions are dynamically loaded if Bash is version 4.0 or greater. Otherwise, they're all loaded on startup. -#### pdksh +#### Korn shell -The pdksh configuration files and functions are not nearly as featureful as the -Bash ones. They're tested on OpenBSD and FreeBSD pdksh implementations, but the -former is the primary system for which I'm maintaining them, and there are some -feature differences. +The `ksh` configuration files and functions are not nearly as featureful as the +Bash ones. At the moment these are mainly being maintained for use on OpenBSD +`pdksh`. #### Yash diff --git a/check/ksh b/check/ksh new file mode 100755 index 00000000..3136c413 --- /dev/null +++ b/check/ksh @@ -0,0 +1,6 @@ +#!/bin/sh +for ksh in ksh/* ksh/kshrc.d/* ; do + [ -f "$ksh" ] || continue + ksh -n "$ksh" || exit +done +printf 'All ksh scripts parsed successfully.\n' diff --git a/check/pdksh b/check/pdksh deleted file mode 100755 index fd1d55b7..00000000 --- a/check/pdksh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -for pdksh in pdksh/* pdksh/pdkshrc.d/* ; do - [ -f "$pdksh" ] || continue - ksh -n "$pdksh" || exit -done -printf 'All pdksh scripts parsed successfully.\n' diff --git a/pdksh/pdkshrc b/ksh/kshrc index 48799c2e..cf7812d6 100644 --- a/pdksh/pdkshrc +++ b/ksh/kshrc @@ -3,11 +3,11 @@ set -o braceexpand set -o emacs # Save history -HISTFILE=$HOME/.pdksh_history +HISTFILE=$HOME/.ksh_history HISTSIZE=$((1 << 10)) # Load any supplementary scripts -for pdkshrc in "$HOME"/.pdkshrc.d/*.pdksh ; do - [[ -e $pdkshrc ]] && . "$pdkshrc" +for kshrc in "$HOME"/.kshrc.d/*.ksh ; do + [[ -e $kshrc ]] && . "$kshrc" done -unset -v pdkshrc +unset -v kshrc diff --git a/pdksh/pdkshrc.d/prompt.pdksh b/ksh/kshrc.d/prompt.ksh index 63e965f9..90e813f0 100644 --- a/pdksh/pdkshrc.d/prompt.pdksh +++ b/ksh/kshrc.d/prompt.ksh @@ -1,5 +1,13 @@ # All of this is only known to work on OpenBSD's fork of pdksh -[[ $(uname -s) == OpenBSD ]] || return +case $KSH_VERSION in + *'PD KSH'*) + case $(uname -s) in + OpenBSD) ;; + *) return ;; + esac + ;; + *) return ;; +esac # Frontend to controlling prompt prompt() { diff --git a/lint/ksh b/lint/ksh new file mode 100755 index 00000000..5c5445fc --- /dev/null +++ b/lint/ksh @@ -0,0 +1,2 @@ +#!/bin/sh +find ksh -type f -print -exec shellcheck -e SC1090 -s ksh -- {} \; diff --git a/lint/pdksh b/lint/pdksh deleted file mode 100755 index 03745b3d..00000000 --- a/lint/pdksh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -find pdksh -type f -print -exec shellcheck -e SC1090 -s ksh -- {} \; diff --git a/sh/shrc.d/ksh.sh b/sh/shrc.d/ksh.sh index 046cd6c4..9cb72e8e 100644 --- a/sh/shrc.d/ksh.sh +++ b/sh/shrc.d/ksh.sh @@ -2,9 +2,7 @@ # configuration if it was defined or if we can find it. Bash and Zsh invoke # their own rc files first, which I've written to then look for ~/.shrc; ksh # does it the other way around. -case $KSH_VERSION in - *'PD KSH '*|*'MIRBSD KSH '*) - [ -f "${KSH_ENV:="$HOME"/.pdkshrc}" ] || return - . "$KSH_ENV" - ;; -esac +[ -n "$KSH_VERSION" ] || return +[ -n "$KSH_ENV" ] || KSH_ENV=$HOME/.kshrc +[ -f "$KSH_ENV" ] || return +. "$KSH_ENV" diff --git a/vim/after/ftdetect/sh.vim b/vim/after/ftdetect/sh.vim index 3bc10ba7..c974e293 100644 --- a/vim/after/ftdetect/sh.vim +++ b/vim/after/ftdetect/sh.vim @@ -9,7 +9,7 @@ augroup dfsh " Names/paths of things that are Korn shell script autocmd BufNewFile,BufRead - \ **/.dotfiles/pdksh/**,.pdkshrc,*.pdksh + \ **/.dotfiles/ksh/**,.kshrc,*.ksh \ let b:is_kornshell = 1 | \ setlocal filetype=sh |