add directory bin

This commit is contained in:
gohigh
2024-02-19 00:21:52 -05:00
parent 1b1e027f34
commit 42f484790f
611 changed files with 242668 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
#! /bin/sh
#
# Convert Csh aliases to Bash aliases. Adapted from a similar program
# supplied with zsh.
#
# This is a quick script to convert csh aliases to bash aliases/functions.
# Pipe the output of csh's alias command through this; it will generate
# a series of alias/function definitions on stdout, suitable for
# processing by bash.
#
# This is not perfect, but it gets most common aliases; it should manage to
# cut down a lot of the busy work.
#
sed -e 's/ (\(.*\))/ \1/' >/tmp/cz$$.1
grep ! /tmp/cz$$.1 >/tmp/cz$$.2
grep -v ! /tmp/cz$$.1 >/tmp/cz$$.3
sed -e "s/'/'"\\\\"''"/g -e 's/^\([^ ]*\) \(.*\)$/alias \1='"'\2'/" \
/tmp/cz$$.3
sed -e 's/![:#]*/$/g' -e 's/^\([^ ]*\) \(.*\)$/\1 () { \2 }/' /tmp/cz$$.2
rm /tmp/cz$$.?
exit 0

View File

@@ -0,0 +1,103 @@
#
# An almost ksh-compatible `autoload'. A function declared as `autoload' will
# be read in from a file the same name as the function found by searching the
# $FPATH (which works the same as $PATH), then that definition will be run.
#
# To do this without source support, we define a dummy function that, when
# executed, will load the file (thereby re-defining the function), then
# execute that newly-redefined function with the original arguments.
#
# It's not identical to ksh because ksh apparently does lazy evaluation
# and looks for the file to load from only when the function is referenced.
# This one requires that the file exist when the function is declared as
# `autoload'.
#
# usage: autoload func [func...]
#
# The first cut of this was by Bill Trost, trost@reed.bitnet
#
# Chet Ramey
# chet@ins.CWRU.Edu
#
# Declare a function ($1) to be autoloaded from a file ($2) when it is first
# called. This defines a `temporary' function that will `.' the file
# containg the real function definition, then execute that new definition with
# the arguments given to this `fake' function. The autoload function defined
# by the file and the file itself *must* be named identically.
#
aload()
{
eval $1 '() { . '$2' ; '$1' "$@" ; return $? }'
}
#
# Search $FPATH for a file the same name as the function given as $1, and
# autoload the function from that file. There is no default $FPATH.
#
autoload()
{
#
# Save the list of functions; we're going to blow away the arguments
# in a second. If any of the names contain white space, TFB.
#
local args="$*"
#
# This should, I think, list the functions marked as autoload and not
# yet defined, but we don't have enough information to do that here.
#
if [ $# -eq 0 ] ; then
echo "usage: autoload function [function...]"
return 1
fi
#
# If there is no $FPATH, there is no work to be done
#
if [ -z "$FPATH" ] ; then
echo autoload: FPATH not set
return 1
fi
#
# This treats FPATH exactly like PATH: a null field anywhere in the
# FPATH is treated the same as the current directory.
#
# The path splitting command is taken from Kernighan and Pike
#
fp=$(echo $FPATH | sed 's/^:/.:/
s/::/:.:/g
s/:$/:./
s/:/ /g')
for FUNC in $args ; do
#
# We're blowing away the arguments to autoload here...
# We have to; there are no arrays.
#
set $fp
while [ $# -ne 0 ] ; do
if [ -f $1/$FUNC ] ; then
break # found it!
fi
shift
done
if [ $# -eq 0 ] ; then
echo "$FUNC: autoload function not found"
continue
fi
# echo auto-loading $FUNC from $1/$FUNC
aload $FUNC $1/$FUNC
done
return 0
}

View File

@@ -0,0 +1,23 @@
# Date: Fri, 11 Oct 91 11:22:36 edt
# From: friedman@gnu.ai.mit.edu
# To: bfox@gnu.ai.mit.edu
# A replacement for basename(1). Not all the systems I use have this
# program. Usage: basename [path] {extension}
function basename ()
{
local path="$1"
local suffix="$2"
local tpath="${path%/}"
# Strip trailing '/' characters from path (unusual that this should
# ever occur, but basename(1) seems to deal with it.)
while [ "${tpath}" != "${path}" ]; do
tpath="${path}"
path="${tpath%/}"
done
path="${path##*/}" # Strip off pathname
echo ${path%${suffix}} # Also strip off extension, if any.
}

View File

@@ -0,0 +1,36 @@
# C-shell compatabilty package.
# setenv VAR VALUE
function setenv () {
export $1="$2"
}
function unsetenv () {
unset $1
}
function alias () {
local name=$1
shift
local value="$*"
if [ "$name" = "" ]; then
builtin alias
elif [ "$value" = "" ]; then
builtin alias $name
else
builtin alias $name="$value"
fi
}
# Can't write foreach yet. Need pattern matching, and a few extras.
function foreach () {
echo 'Can'\''t do `foreach'\'' yet. Type "help for".'
}
# Make this work like csh's. Special case "term" and "path".
#set () {
#}
chdir () {
builtin cd $*
}

View File

@@ -0,0 +1,21 @@
# Date: Fri, 11 Oct 91 11:22:36 edt
# From: friedman@gnu.ai.mit.edu
# To: bfox@gnu.ai.mit.edu
# A replacement for dirname(1). This one appears less often on some
# systems I use than basename(1), and I really depend on it for some
# things. Usage: dirname [path]
function dirname ()
{
local dir="$1"
local tdir="${dir%/}"
# Strip trailing '/' characters from dir (unusual that this should
# ever occur, but dirname(1) seems to deal with it.)
while [ "${tdir}" != "${dir}" ]; do
tdir="${dir}"
dir="${tdir%/}"
done
echo "${dir%/*}"
}

View File

@@ -0,0 +1,22 @@
# Contributed by Noah Friedman and Roland McGrath.
# To be run by the PROMPT_COMMAND variable, so that one can see what
# the exit status of processes are.
function check_exit_status ()
{
local status="$?"
local signal=""
if [ ${status} -ne 0 -a ${status} != 128 ]; then
# If process exited by a signal, determine name of signal.
if [ ${status} -gt 128 ]; then
signal="$(builtin kill -l $[${status} - 128] 2>/dev/null)"
if [ "$signal" ]; then signal="($signal)"; fi
fi
echo "[Exit ${status} ${signal}]" 1>&2
fi
return 0
}
PROMPT_COMMAND=check_exit_status

View File

@@ -0,0 +1,50 @@
# Contributed by Noah Friedman.
# To avoid using a function in bash, you can use the `builtin' or
# `command' builtins, but neither guarantees that you use an external
# program instead of a bash builtin if there's a builtin by that name. So
# this function can be used like `command' except that it guarantees the
# program is external by first disabling any builtin by that name. After
# the command is done executing, the state of the builtin is restored.
function external ()
{
local state=""
local exit_status
if builtin_p "$1"; then
state="builtin"
enable -n "$1"
fi
command "$@"
exit_status=$?
if [ "$state" = "builtin" ]; then
enable "$1"
fi
return ${exit_status}
}
# What is does is tell you if a particular keyword is currently enabled as
# a shell builtin. It does NOT tell you if invoking that keyword will
# necessarily run the builtin. For that, do something like
#
# test "$(builtin type -type [keyword])" = "builtin"
#
# Note also, that disabling a builtin with "enable -n" will make builtin_p
# return false, since the builtin is no longer available.
function builtin_p ()
{
local word
set $(builtin type -all -type "$1")
for word in "$@" ; do
if [ "${word}" = "builtin" ]; then
return 0
fi
done
return 1
}

View File

@@ -0,0 +1,13 @@
# Who said shells can't use recursion? Here is a factorial function.
# You call it with a number as an argument, and it returns the factorial
# of that number.
fact ()
{
local num=$1;
if [ "$num" = 1 ] ; then
echo 1
return ;
fi;
echo $[ $num * $(fact $[ $num - 1 ])]
}

View File

@@ -0,0 +1,63 @@
#
# fstty
#
# A function that works as a front end for both stty and the `bind'
# builtin, so the tty driver and readline see the same changes
#
# chet@ins.cwru.edu
#
#
# Convert between the stty ^H control character form and the readline \C-H
# form
#
cvt()
{
echo "$@" | cat -v | sed 's/\^/\\C-/'
}
#
# stty front-end. Parses the argument list and creates two command strings,
# one for stty, another for bind.
#
fstty()
{
local cmd="" bargs=""
local e
while [ $# -gt 0 ]
do
case "$1" in
-a) cmd="$cmd everything"
;;
erase) shift;
e=$(cvt "$1")
cmd="$cmd erase $1"
bargs="$bargs '$e: backward-delete-char'"
;;
kill) shift
e=$(cvt "$1")
cmd="$cmd kill $1"
bargs="$bargs '$e: unix-line-discard'"
;;
werase) shift;
e=$(cvt "$1")
cmd="$cmd erase $1"
bargs="$bargs '$e: backward-kill-word'"
;;
lnext) shift;
e=$(cvt "$1")
cmd="$cmd erase $1"
bargs="$bargs '$e: quoted-insert'"
;;
*) cmd="$cmd $1"
;;
esac
shift
done
command stty $cmd
if [ -n "$bargs" ]; then
builtin bind $bargs
fi
}

View File

@@ -0,0 +1,148 @@
#
# ksh-compat -- functions and aliases to provide the beginnings of a ksh
# environment for bash.
#
# Chet Ramey
# chet@ins.CWRU.Edu
#
#
# These are definitions for the ksh compiled-in `exported aliases'. There
# are others, but we already have substitutes for them: "history", "type",
# and "hash".
#
alias r="fc -e -"
alias functions="typeset -f"
alias integer="typeset -i"
alias nohup="nohup "
alias true=":"
alias false="let 0"
#
# An almost-ksh compatible `whence' command. This is as hairy as it is
# because of the desire to exactly mimic ksh (whose behavior was determined
# empirically).
#
# This depends somewhat on knowing the format of the output of the bash
# `builtin type' command.
#
whence ()
{
local vflag
local path
vflag=
path=
if [ "$#" = "0" ]; then
echo "whence: argument expected"
return 1
fi
case "$1" in
-v) vflag=1
shift 1
;;
-*) echo "whence: bad option: $1"
return 1
;;
*) ;;
esac
if [ "$#" = "0" ]; then
echo "whence: bad argument count"
return 1
fi
for cmd; do
if [ "$vflag" ]; then
echo $(builtin type $cmd | sed 1q)
else
path=$(builtin type -path $cmd)
if [ "$path" ]; then
echo $path
else
case "$cmd" in
/*) echo ""
;;
*)
case "$(builtin type -type $cmd)" in
"") echo ""
;;
*) echo "$cmd"
;;
esac
;;
esac
fi
fi
done
return 0
}
#
# For real ksh homeboy fanatics, redefine the `type' builtin with a ksh
# version.
#
#type()
#{
# whence -v "$*"
#}
cd ()
{
case $# in
0) builtin cd "$HOME" ;;
1) builtin cd "$@" ;;
2) old="$1"
new="$2"
dir=$(echo "$PWD" | sed "s:$old:$new:g")
case "$dir" in
"$PWD") echo "bash: cd: bad substitution" >&2 ;;
*) echo "$dir"
builtin cd "$dir"
;;
esac
;;
*) echo "cd: wrong arg count" >&2 ;;
esac
}
#
# ksh print emulation
#
# print [-Rnprsu[n]] [arg ...]
#
# - end of options
# -R BSD-style -- only accept -n, no escapes
# -n do not add trailing newline
# -p no-op (no coprocesses)
# -r no escapes
# -s no-op (print to the history file)
# -u n redirect output to fd n
#
print()
{
local eflag=-e
local nflag=
local fd=1
OPTIND=1
while getopts "Rnprsu:" c; do
case $c in
R|r) eflag= ;;
n) nflag=-n ;;
u) redir=">&$OPTARG"
fd=$OPTARG
;;
p|s) ;;
esac
done
shift $[ $OPTIND - 1 ]
echo $eflag $nflag "$@" >&$fd
}

View File

@@ -0,0 +1,88 @@
#
# .kshenv -- functions and aliases to provide the beginnings of a ksh
# environment for bash.
#
# Chet Ramey
# chet@ins.CWRU.Edu
#
#
# These are definitions for the ksh compiled-in `exported aliases'. There
# are others, but we already have substitutes for them: "history", "type",
# and "hash".
#
alias r="fc -e -"
alias functions="typeset -f"
alias integer="typeset -i"
alias nohup="nohup "
alias true=":"
alias false="let 0"
#
# An almost-ksh compatible `whence' command. This is as hairy as it is
# because of the desire to exactly mimic ksh (whose behavior was determined
# empirically).
#
# This depends somewhat on knowing the format of the output of the bash
# `builtin type' command.
#
whence()
{
local vflag
local path
vflag=
path=
if [ "$#" = "0" ] ; then
echo "whence: argument expected"
return 1
fi
case "$1" in
-v) vflag=1
shift 1
;;
-*) echo "whence: bad option: $1"
return 1
;;
*) ;;
esac
if [ "$#" = "0" ] ; then
echo "whence: bad argument count"
return 1
fi
for cmd
do
if [ "$vflag" ] ; then
echo $(builtin type $cmd | sed 1q)
else
path=$(builtin type -path $cmd)
if [ "$path" ] ; then
echo $path
else
case "$cmd" in
/*) echo ""
;;
*) case "$(builtin type -type $cmd)" in
"") echo ""
;;
*) echo "$cmd"
;;
esac
;;
esac
fi
fi
done
return 0
}
#
# For real ksh homeboy fanatics, redefine the `type' builtin with a ksh
# version.
#
#type()
#{
# whence -v "$*"
#}

View File

@@ -0,0 +1,7 @@
shcat()
{
while read line
do
echo "$line"
done
}

View File

@@ -0,0 +1,79 @@
#
# substr -- a function to emulate the ancient ksh builtin
#
#
# -l == shortest from left
# -L == longest from left
# -r == shortest from right (the default)
# -R == longest from right
substr()
{
local flag pat str
local usage="usage: substr -lLrR pat string or substr string pat"
case "$1" in
-l | -L | -r | -R)
flag="$1"
pat="$2"
shift 2
;;
-*)
echo "substr: unknown option: $1"
echo "$usage"
return 1
;;
*)
flag="-r"
pat="$2"
;;
esac
if [ "$#" -eq 0 -o "$#" -gt 2 ] ; then
echo "substr: bad argument count"
return 2
fi
str="$1"
#
# We don't want -f, but we don't want to turn it back on if
# we didn't have it already
#
case "$-" in
"*f*")
;;
*)
fng=1
set -f
;;
esac
case "$flag" in
-l)
str="${str#$pat}" # substr -l pat string
;;
-L)
str="${str##$pat}" # substr -L pat string
;;
-r)
str="${str%$pat}" # substr -r pat string
;;
-R)
str="${str%%$pat}" # substr -R pat string
;;
*)
str="${str%$2}" # substr string pat
;;
esac
echo "$str"
#
# If we had file name generation when we started, re-enable it
#
if [ "$fng" = "1" ] ; then
set +f
fi
}

View File

@@ -0,0 +1,81 @@
#
# substr -- a function to emulate the ancient ksh builtin
#
# -l == remove shortest from left
# -L == remove longest from left
# -r == remove shortest from right (the default)
# -R == remove longest from right
substr()
{
local flag pat str
local usage="usage: substr -lLrR pat string or substr string pat"
local options="l:L:r:R:"
OPTIND=1
while getopts "$options" c
do
case "$c" in
l | L | r | R)
flag="-$c"
pat="$OPTARG"
;;
'?')
echo "$usage"
return 1
;;
esac
done
if [ "$OPTIND" -gt 1 ] ; then
shift $[ $OPTIND -1 ]
fi
if [ "$#" -eq 0 -o "$#" -gt 2 ] ; then
echo "substr: bad argument count"
return 2
fi
str="$1"
#
# We don't want -f, but we don't want to turn it back on if
# we didn't have it already
#
case "$-" in
"*f*")
;;
*)
fng=1
set -f
;;
esac
case "$flag" in
-l)
str="${str#$pat}" # substr -l pat string
;;
-L)
str="${str##$pat}" # substr -L pat string
;;
-r)
str="${str%$pat}" # substr -r pat string
;;
-R)
str="${str%%$pat}" # substr -R pat string
;;
*)
str="${str%$2}" # substr string pat
;;
esac
echo "$str"
#
# If we had file name generation when we started, re-enable it
#
if [ "$fng" = "1" ] ; then
set +f
fi
}

View File

@@ -0,0 +1,35 @@
#
# term -- a shell function to set the terminal type interactively or not.
#
term()
{
local t
if [ $# != 0 ] ; then
eval $(tset -sQ $1)
else # interactive
if [ -z "$TERM" ] ; then
TERM="unknown"
fi
case "$TERM" in
network|dialup|unknown|lat)
TERM=unknown
;;
*)
eval $(tset -sQ)
;;
esac
while [ "$TERM" = "unknown" ] ; do
echo -n "Terminal type: "
read t
if [ -n "$t" ] ; then
eval $(tset -sQ $t)
fi
done
fi
}

View File

@@ -0,0 +1,51 @@
#
# whatis -- and implementation of the 10th Edition Unix sh builtin `whatis'
# command.
#
# usage: whatis arg [...]
#
# For each argument, whatis prints the associated value as a parameter,
# builtin, function, alias, or executable file as appropriate. In each
# case, the value is printed in a form which would yield the same value
# if typed as input to the shell itself.
#
whatis()
{
local wusage='usage: whatis arg [arg...]'
local fail=0
if [ $# -eq 0 ] ; then
echo "$wusage"
return 1
fi
for arg
do
case $(builtin type -type $arg) in
"alias")
echo "$(alias $arg)"
;;
"function")
builtin type "$arg" | sed 1d
;;
"builtin")
echo builtin "$arg"
;;
"file")
echo $(type -path "$arg")
;;
*)
# OK, we could have a variable, or we could have nada
if [ "$(eval echo \${$arg+set})" = "set" ] ; then
# It is a variable, and it is set
echo -n "$arg="
eval echo \$$arg
else
fail=1
fi
;;
esac
done
return $fail
}

View File

@@ -0,0 +1,63 @@
#
# An almost-ksh compatible `whence' command. This is as hairy as it is
# because of the desire to exactly mimic ksh.
#
# This depends somewhat on knowing the format of the output of the bash
# `builtin type' command.
#
# Chet Ramey
# chet@ins.CWRU.Edu
#
whence()
{
local vflag
local path
vflag=
path=
if [ "$#" = "0" ] ; then
echo "whence: argument expected"
return 1
fi
case "$1" in
-v) vflag=1
shift 1
;;
-*) echo "whence: bad option: $1"
return 1
;;
*) ;;
esac
if [ "$#" = "0" ] ; then
echo "whence: bad argument count"
return 1
fi
for cmd
do
if [ "$vflag" ] ; then
echo $(builtin type $cmd | sed 1q)
else
path=$(builtin type -path $cmd)
if [ "$path" ] ; then
echo $path
else
case "$cmd" in
/*) echo ""
;;
*) case "$(builtin type -type $cmd)" in
"") echo ""
;;
*) echo "$cmd"
;;
esac
;;
esac
fi
fi
done
return 0
}

View File

@@ -0,0 +1,57 @@
#
# An almost-ksh compatible `whence' command. The one difference between this
# and the real ksh `whence' is that this version, when the "-v" flag is not
# given and presented with something that is not in the path, simply echos it
# without more checking to see if it is a function, builtin, or alias.
#
# Chet Ramey
# chet@ins.CWRU.Edu
#
whence()
{
local vflag
local path
vflag=
path=
if [ $# = "0" ] ; then
echo "whence: argument expected"
return 1
fi
case "$1" in
-v) vflag=1
shift 1
;;
-*) echo "whence: bad option: $1"
return 1
;;
*) ;;
esac
if [ $# = "0" ] ; then
echo "whence: bad argument count"
return 1
fi
for cmd
do
if [ "$vflag" ] ; then
echo $(builtin type $cmd | sed 1q)
else
path=$(builtin type -path $cmd)
if [ "$path" ] ; then
echo $path
else
case "$cmd" in
/*) echo ""
;;
*) echo "$cmd"
;;
esac
fi
fi
done
return 0
}

View File

@@ -0,0 +1,12 @@
dir
info dir
dir /usr/gnu/src/bash:/usr/gnu/src/bash/builtins
where
frame
where
up
up
down
down
where
quit

View File

@@ -0,0 +1,137 @@
#
# shprompt -- give a prompt and get an answer satisfying certain criteria
#
# shprompt [-dDfFsy] prompt
# s = prompt for string
# f = prompt for filename
# F = prompt for full pathname to a file or directory
# d = prompt for a directory name
# D = prompt for a full pathname to a directory
# y = prompt for y or n answer
#
# Chet Ramey
# chet@ins.CWRU.Edu
type=file
OPTS=dDfFsy
succeed()
{
echo "$1"
exit 0
}
while getopts "$OPTS" c
do
case "$c" in
s) type=string
;;
f) type=file
;;
F) type=path
;;
d) type=dir
;;
D) type=dirpath
;;
y) type=yesno
;;
?) echo "usage: $0 [-$OPTS] prompt" 1>&2
exit 2
;;
esac
done
if [ "$OPTIND" -gt 1 ] ; then
shift $[$OPTIND - 1]
fi
while :
do
case "$type" in
string)
echo -n "$1" 1>&2
read ans || exit 1
if [ -n "$ans" ] ; then
succeed "$ans"
fi
;;
file|path)
echo -n "$1" 1>&2
read ans || exit 1
#
# use `fn' and eval so that bash will do tilde expansion for
# me
#
eval fn="$ans"
case "$fn" in
/*) if test -e "$fn" ; then
succeed "$fn"
else
echo "$0: '$fn' does not exist" 1>&2
fi
;;
*) if [ "$type" = "path" ] ; then
echo "$0: must give full pathname to file" 1>&2
else
if test -e "$fn" ; then
succeed "$fn"
else
echo "$0: '$fn' does not exist" 1>&2
fi
fi
;;
esac
;;
dir|dirpath)
echo -n "$1" 1>&2
read ans || exit 1
#
# use `fn' and eval so that bash will do tilde expansion for
# me
#
eval fn="$ans"
case "$fn" in
/*) if test -d "$fn" ; then
succeed "$fn"
elif test -e "$fn" ; then
echo "$0 '$fn' is not a directory" 1>&2
else
echo "$0: '$fn' does not exist" 1>&2
fi
;;
*) if [ "$type" = "dirpath" ] ; then
echo "$0: must give full pathname to directory" 1>&2
else
if test -d "$fn" ; then
succeed "$fn"
elif test -e "$fn" ; then
echo "$0 '$fn' is not a directory" 1>&2
else
echo "$0: '$fn' does not exist" 1>&2
fi
fi
;;
esac
;;
yesno)
echo -n "$1" 1>&2
read ans || exit 1
case "$ans" in
y|Y|[yY][eE][sS])
succeed "yes"
;;
n|N|[nN][oO])
succeed "no"
exit 0
;;
*)
echo "$0: yes or no required" 1>&2
;;
esac
;;
esac
done
exit 1

View File

@@ -0,0 +1,63 @@
# Some useful aliases.
alias texclean='rm -f *.toc *.aux *.log *.cp *.fn *.tp *.vr *.pg *.ky'
alias clean='echo -n "Really clean this directory?";
read yorn;
if test "$yorn" = "y"; then
rm -f \#* *~ .*~ *.bak .*.bak *.tmp .*.tmp core a.out;
echo "Cleaned.";
else
echo "Not cleaned.";
fi'
alias h='history'
alias j="jobs -l"
alias l="ls -l "
alias ll="ls -l"
alias ls="ls -F"
alias term='set noglob; eval `tset -Q -s `'
alias pu="pushd"
alias po="popd"
#
# Csh compatability:
#
alias unsetenv=unset
function setenv () {
export $1="$2"
}
# Function which adds an alias to the current shell and to
# the ~/.bash_aliases file.
add-alias ()
{
local name=$1 value="$2"
echo alias $name=\'$value\' >>~/.bash_aliases
eval alias $name=\'$value\'
alias $name
}
# "repeat" command. Like:
#
# repeat 10 echo foo
repeat ()
{
local count="$1" i;
shift;
for i in $(seq 1 "$count");
do
eval "$@";
done
}
# Subfunction needed by `repeat'.
seq ()
{
local lower upper output;
lower=$1 upper=$2;
while [ $lower -le $upper ];
do
output="$output $lower";
lower=$[ $lower + 1 ];
done;
echo $output
}

View File

@@ -0,0 +1,20 @@
# Startup file for bash login shells.
#
default_dir=/usr/local/lib/
if [ "$PS1" ]; then
PS1='\u@\h(\#)$ '
ignoreeof=3
fi
LOGIN_SHELL=true
# If the user has her own init file, then use that one, else use the
# canonical one.
if [ -f ~/.bashrc ]; then
source ~/.bashrc
else if [ -f ${default_dir}Bashrc ]; then
source ${default_dir}Bashrc;
fi
fi

View File

@@ -0,0 +1,72 @@
# Bourne Again SHell init file.
#
# Files you make look like rw-rw-r
umask 002
# Don't make useless coredump files. If you want a coredump,
# say "ulimit -c unlimited" and then cause a segmentation fault.
ulimit -c 0
# Sometimes, there are lots of places that one can find tex inputs.
export TEXINPUTS=.:$HOME/bin:/usr/lib/tex/inputs:/usr/local/lib/tex/inputs
# Where's the Gnu stuff at?
GNU=/usr/gnu/bin
X11=/usr/bin/X11
UTIL_PATH=$GNU:$X11
STANDARD_PATH=/usr/local/bin:/usr/ucb:/bin:/usr/bin:/usr/etc:/etc:/usr/games
if [ "$HOSTTYPE" = "sony" ]; then STANDARD_PATH=STANDARD_PATH:/usr/sony/bin; fi
if [ -d $HOME/bin/$HOSTTYPE ]; then
MY_PATH=$HOME/bin/$HOSTTYPE
fi
if [ -d $HOME/bin ]; then
MY_PATH=$MY_PATH:$HOME/bin
fi
if [ -d /usr/hosts ]; then
STANDARD_PATH=$STANDARD_PATH:/usr/hosts
fi
PATH=.:$MY_PATH:$UTIL_PATH:$STANDARD_PATH
# If running interactively, then:
if [ "$PS1" ]; then
# Set ignoreeof if you don't want EOF as the sole input to the shell to
# immediately signal a quit condition. This only happens at the start
# of a line if the line is empty, and you haven't just deleted a character
# with C-d. I turn this on in ~/.bash_profile so that only login shells
# have the right to be obnoxious.
# ignoreeof=
# Set auto_resume if you want to resume on "emacs", as well as on
# "%emacs".
auto_resume=
# Set notify if you want to be asynchronously notified about background
# job completion.
notify=
# Make it so that failed `exec' commands don't flush this shell.
no_exit_on_failed_exec=
if [ ! "$LOGIN_SHELL" ]; then
PS1="\u@\h\$ "
fi
HISTSIZE=256
MAILCHECK=60
# A couple of default aliases.
alias j='jobs -l'
alias po=popd
alias pu=pushd
alias ls='ls -F'
if [ -f ~/.bash_aliases ]; then
source ~/.bash_aliases
fi
fi

View File

@@ -0,0 +1,30 @@
#Posted-Date: Fri, 9 Mar 90 18:34:29 EST
#Date: Fri, 9 Mar 90 18:34:29 EST
#From: "Eirik Fuller" <wonton.tn.cornell.edu!eirik@ucsbcsl.UUCP>
#To: bfox@ai.mit.edu (Brian Fox)
#Subject: Patch to bash 1.05 for SunView
#
#I think this works:
#
Mu|sun-cmd:am:bs:km:pt:li#34:co#80:cl=^L:ce=\E[K:cd=\E[J:rs=\E[s:
#
#Another alternative is to send the ti string at startup time (and, I
#guess, the te string at exit time); that is how vi works in a cmdtool.
#The best reason to not do this is that this also disables scrolling
#which, as I understand it, is why anyone would use cmdtool in the
#first place. Sending the ti string at startup time would do strange
#things on other systems too; in xterm it would use the alternate
#screen.
#
#The problem with cmdtool, in case that is less than obvious, is that
#almost none of the capabilities advertised in /etc/termcap are enabled
#while scrolling is enabled. It has other problems too, like being
#part of an outdated proprietary windowing system, but there's probably
#no need to dwell on that. In a sense, though, the sun-cmd termcap
#entry doesn't lie about the capabilities; I think the termcap man page
#does warn about some terminals having cursor motion capabilities only
#in the "ti/te window".
#
#A general solution to this problem would require a termcap capability
#which somehow tells which features are available outside of the ti/te
#window. There is no such capability in termcap now, of course.

View File

@@ -0,0 +1,50 @@
#
# whatis -- and implementation of the 10th Edition Unix sh builtin `whatis'
# command.
#
# usage: whatis arg [...]
#
# For each argument, whatis prints the associated value as a parameter,
# builtin, function, alias, or executable file as appropriate. In each
# case, the value is printed in a form which would yield the same value
# if typed as input to the shell itself.
#
whatis ()
{
local fail=0
if [ $# -eq 0 ] ; then
echo 'usage: whatis arg [arg...]'
return 1
fi
for arg; do
case $(builtin type -type $arg 2>/dev/null) in
"alias")
builtin alias "$arg"
;;
"function")
builtin type "$arg" | sed 1d
;;
"builtin")
echo builtin "$arg"
;;
"file")
builtin type -path "$arg"
;;
*)
# OK, we could have a variable, or we could have nada.
if [ "$(eval echo \${$arg+set})" = "set" ] ; then
# It is a variable, and it is set.
echo -n "$arg="
eval echo '\"'\$$arg'\"'
else
echo whatis: $arg: not found
fail=1
fi
;;
esac
done
return $fail
}