From d3a329ecf67cee52958dabb5bf056b457aab1c6c Mon Sep 17 00:00:00 2001 From: david Date: Mon, 12 Jan 2009 01:22:16 -0500 Subject: [PATCH 1/6] head -#number is depricated, replaced with head -n #number --- commonsh/10_alias | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commonsh/10_alias b/commonsh/10_alias index 72f0ccd..a915598 100755 --- a/commonsh/10_alias +++ b/commonsh/10_alias @@ -41,7 +41,7 @@ case `uname -s` in alias ls="gls -h --color=auto" else # you have a GNU ls, surprise... - case `ls --version 2>/dev/null | head -1` in + case `ls --version 2>/dev/null | head -n 1` in *fileutils*|*coreutils*) alias ls="ls -h --color=auto" ;; @@ -55,7 +55,7 @@ case `uname -s` in alias grep='ggrep -d skip --color=auto' else # woah, you have a GNU grep... - case `grep --version 2>/dev/null | head -1` in + case `grep --version 2>/dev/null | head -n 1` in *GNU*) alias grep='grep -d skip --color=auto' ;; From f19b125086bdb859e05535d59171c81b5d84b81a Mon Sep 17 00:00:00 2001 From: david Date: Mon, 12 Jan 2009 01:23:01 -0500 Subject: [PATCH 2/6] fix keybindings for sun machines --- inputrc | 5 +++++ vimrc | 3 +++ zsh/bindkey | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/inputrc b/inputrc index 667c6ca..bb12dec 100644 --- a/inputrc +++ b/inputrc @@ -142,6 +142,11 @@ $if mode=emacs "\e[H": beginning-of-line "\e[U": end-of-line $endif + $if term=sun + "\e[214z": beginning-of-line + "\e[220z": end-of-line + "^?": delete-char + $endif $if term=cygwin "\e[1~": beginning-of-line "\e[4~": end-of-line diff --git a/vimrc b/vimrc index 06fdecd..398df76 100644 --- a/vimrc +++ b/vimrc @@ -264,8 +264,11 @@ inoremap # X# map map! if (&term =~ "interix") + map + map! map  map  +elseif (&term =~ "^sun") map map! elseif (&term !~ "cons") diff --git a/zsh/bindkey b/zsh/bindkey index c6b099a..d6b8715 100755 --- a/zsh/bindkey +++ b/zsh/bindkey @@ -61,6 +61,11 @@ case $TERM in bindkey '\e[U' end-of-line bindkey '^?' delete-char ;; + sun*) + bindkey '\e[214z' beginning-of-line + bindkey '\e[220z' end-of-line + bindkey '^?' delete-char + ;; cygwin*) bindkey '\e[1~' beginning-of-line bindkey '\e[4~' end-of-line From 256a3daad2ae8fdd48e411ecd9a8147cb1a803ca Mon Sep 17 00:00:00 2001 From: david Date: Mon, 12 Jan 2009 03:06:42 -0500 Subject: [PATCH 3/6] some ksh do not get a $USER, only a $LOGNAME. Make them happy. --- ksh/prompt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ksh/prompt b/ksh/prompt index 739815f..5479b99 100755 --- a/ksh/prompt +++ b/ksh/prompt @@ -1,9 +1,12 @@ -if [ $USER = root ] ; then +if [ ! $USER ] ; then + USER=$LOGNAME +fi + +if [ $USER ] && [ $USER = root ] ; then BASE="#" else BASE="$" fi - PS1=$'\E[01;32m'"${USER} "$'\E[01;34m''$PWD'" ${BASE} "$'\E[0m' export PS1 From 736b88e7e35f1ae2b9dfd9e5f024e87917b8f8ed Mon Sep 17 00:00:00 2001 From: david Date: Mon, 12 Jan 2009 03:20:58 -0500 Subject: [PATCH 4/6] replace source with ., more independent --- bash_profile | 2 +- zsh/icc | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bash_profile b/bash_profile index 86795d7..d1fb79b 100644 --- a/bash_profile +++ b/bash_profile @@ -1 +1 @@ -source ~/.bashrc +. ~/.bashrc diff --git a/zsh/icc b/zsh/icc index 92a299d..9652e8f 100755 --- a/zsh/icc +++ b/zsh/icc @@ -4,19 +4,19 @@ if [ -d "/opt/intel/Compiler" ] ; then if [ -r $iccvars_path ] ; then case `uname -m` in x86_64) - source $iccvars_path intel64 + . $iccvars_path intel64 ;; i*86) - source $iccvars_path ia32 + . $iccvars_path ia32 ;; ia64) - source $iccvars_path ia64 + . $iccvars_path ia64 ;; esac fi elif [ -d "/opt/intel/cc" ] || [ -d "/opt/intel/cce" ] ; then iccvars_path=$(echo /opt/intel/cc*/(10|9).*/bin/iccvars.sh(On[1])) if [ -r $iccvars_path ] ; then - source $iccvars_path + . $iccvars_path fi fi From 56ab7d9c0d76362730be8a9cfb2b87b1b1185670 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 12 Jan 2009 03:21:41 -0500 Subject: [PATCH 5/6] type -p does not work as well as command -v, go away type -p ! --- commonsh/02_term | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commonsh/02_term b/commonsh/02_term index ee2a774..29cf243 100755 --- a/commonsh/02_term +++ b/commonsh/02_term @@ -65,7 +65,7 @@ TERM=`fix_term $TERM` # I am sorry to hear that you are running an # xterm that has no colors (I am looking at you solaris) -if [ $TERM = xterm ] && (type -p tput > /dev/null 2>&1) && [ `tput -T xterm colors` = -1 ] ; then +if [ $TERM = xterm ] && (command -v tput > /dev/null 2>&1) && [ `tput -T xterm colors` = -1 ] ; then # lets see what we can do about your terrible term TERM=`fix_term xterm-color` fi From ecc8c266ab18233d7b914d8d19f1bf51814b5496 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 12 Jan 2009 03:22:26 -0500 Subject: [PATCH 6/6] This makes it easier to think about the length of environment variables --- commonsh/10_pager | 2 +- ksh/prompt | 2 +- zsh/prompt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/commonsh/10_pager b/commonsh/10_pager index 6e3a508..c33adfb 100755 --- a/commonsh/10_pager +++ b/commonsh/10_pager @@ -7,7 +7,7 @@ export PAGER if [ $PAGER = less ] ; then for lesspipe in lesspipe lesspipe.sh ; do lesspipe_test=`command -v ${lesspipe} 2>/dev/null` - if [ -n $lesspipe_test ] ; then + if [ -n "${lesspipe_test}" ] ; then LESSOPEN="| ${lesspipe_test} %s" && break export LESSOPEN fi diff --git a/ksh/prompt b/ksh/prompt index 5479b99..f97779b 100755 --- a/ksh/prompt +++ b/ksh/prompt @@ -1,4 +1,4 @@ -if [ ! $USER ] ; then +if [ -z "${USER}" ] ; then USER=$LOGNAME fi diff --git a/zsh/prompt b/zsh/prompt index de19ff7..5a1ab0b 100755 --- a/zsh/prompt +++ b/zsh/prompt @@ -1,5 +1,5 @@ # prompt -if [ -z ${SSH_TTY} ] ; then +if [ -z "${SSH_TTY}" ] ; then PROMPT=$'%{\e[01;32m%}%n@%m %{\e[01;34m%}%~ %(?..%{\e[01;31m%})%(!.#.$) %{\e[00;00m%}' RPROMPT=$'%1(j.%{\e[00;36m%}[%j].)%{\e[01;33m%}[%t]%{\e[00;00m%}' else