summaryrefslogtreecommitdiff
path: root/examples/startup-files/apple
diff options
context:
space:
mode:
Diffstat (limited to 'examples/startup-files/apple')
-rw-r--r--examples/startup-files/apple/README24
-rw-r--r--examples/startup-files/apple/aliases34
-rw-r--r--examples/startup-files/apple/bash.defaults22
-rw-r--r--examples/startup-files/apple/environment24
-rw-r--r--examples/startup-files/apple/login15
-rw-r--r--examples/startup-files/apple/logout10
-rw-r--r--examples/startup-files/apple/rc63
7 files changed, 192 insertions, 0 deletions
diff --git a/examples/startup-files/apple/README b/examples/startup-files/apple/README
new file mode 100644
index 0000000..07005cb
--- /dev/null
+++ b/examples/startup-files/apple/README
@@ -0,0 +1,24 @@
+This directory contains some useful bash files.
+
+In order to use this configuration:
+
+ echo "source ~/.bashrc" > ~/.profile
+ echo "source /usr/share/init/bash/rc" > ~/.bashrc
+ echo "source /usr/share/init/bash/login" > ~/.login
+
+In order to customize this setup:
+
+ mkdir ~/Library/init/bash
+
+and create the following files there as necessary:
+
+ aliases.mine - shell aliases
+ completions.mine - completions
+ environment.mine - environment
+ rc.mine - run commands
+ path - command search path
+
+See the corresponding file in /usr/share/init/bash for more information about the role of each file. You can easily extend or override the configuration provided by the default file. For example, you can add more aliases by adding the appropriate commands in aliases.mine.
+
+ -Fred
+ tritan@mit.edu
diff --git a/examples/startup-files/apple/aliases b/examples/startup-files/apple/aliases
new file mode 100644
index 0000000..23d3399
--- /dev/null
+++ b/examples/startup-files/apple/aliases
@@ -0,0 +1,34 @@
+##
+# Bash aliases file
+#
+# Wilfredo Sanchez Jr. | tritan@mit.edu
+##
+
+##
+# Aliases
+##
+
+alias .='cwd'
+alias ..='cd ..'
+alias cd..='cd ..'
+alias cdwd='cd $(/bin/pwd)'
+alias cwd='echo $PWD'
+alias l='ls -lg'
+
+##
+# Functions
+##
+
+files () { find ${1} -type f -print ; }
+ff () { find . -name ${1} -print ; }
+ll () { ls -lag "$@" | more ; }
+word () { fgrep -i "$*" /usr/dict/web2 ; }
+wordcount () { cat "${1}" | tr -s ' .,;:?\!()[]"' '\012' | \
+ awk 'END {print NR}' ; }
+
+##
+# Read user's aliases
+##
+if [ -r ${bash_initdir}/aliases.mine ]; then
+ source ${bash_initdir}/aliases.mine
+fi
diff --git a/examples/startup-files/apple/bash.defaults b/examples/startup-files/apple/bash.defaults
new file mode 100644
index 0000000..a80145b
--- /dev/null
+++ b/examples/startup-files/apple/bash.defaults
@@ -0,0 +1,22 @@
+##
+# Bash
+# User preferences file
+# Override these in rc.mine
+#
+# Wilfredo Sanchez Jr. | tritan@mit.edu
+# July 09, 1992
+#
+# MIT Project Athena
+##
+
+if [ -n "$PS1" ]; then
+
+ # Prompts
+ PS1='[\h:\w] \u\$ '
+ PS2=' -> '
+ #PS3=
+ #PS4=
+
+ set -o emacs
+
+fi
diff --git a/examples/startup-files/apple/environment b/examples/startup-files/apple/environment
new file mode 100644
index 0000000..fee218b
--- /dev/null
+++ b/examples/startup-files/apple/environment
@@ -0,0 +1,24 @@
+##
+# Bourne Again Shell environment file
+# Global environment setup
+#
+# Wilfredo Sanchez Jr. | tritan@mit.edu
+# July 09, 1992
+#
+# MIT Project Athena
+#
+# ORIGINAL SOURCES: /usr/athena/lib/init/cshrc (ATHENA REL 7.3P)
+##
+
+export ENV_SET="YES" # avoid repeat
+
+# File creation mask
+umask 022 # all files created are -rw-r--r--
+
+##
+# Load user environment
+##
+
+if [ -f ${bash_initdir}/environment.mine ]; then
+ source ${bash_initdir}/environment.mine
+fi
diff --git a/examples/startup-files/apple/login b/examples/startup-files/apple/login
new file mode 100644
index 0000000..b91f787
--- /dev/null
+++ b/examples/startup-files/apple/login
@@ -0,0 +1,15 @@
+##
+# Set path
+##
+
+export PATH="${HOME}/${MACHTYPE}/bin:${HOME}/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
+
+export MANPATH="${HOME}/man:/usr/local/share/man:/usr/share/man"
+
+##
+# Read user's login
+##
+
+if (-r ${bash_initdir}/login.mine) then
+ source ${bash_initdir}/login.mine
+fi
diff --git a/examples/startup-files/apple/logout b/examples/startup-files/apple/logout
new file mode 100644
index 0000000..812731c
--- /dev/null
+++ b/examples/startup-files/apple/logout
@@ -0,0 +1,10 @@
+##
+# Destroy credentials
+##
+
+if [ -z "${TERM_PROGRAM}" ]; then
+ # Don't run these commands if the shell is launched by Terminal,
+ # even if it's a login shell.
+
+ if klist -s; then kdestroy; fi
+fi
diff --git a/examples/startup-files/apple/rc b/examples/startup-files/apple/rc
new file mode 100644
index 0000000..2451b9f
--- /dev/null
+++ b/examples/startup-files/apple/rc
@@ -0,0 +1,63 @@
+##
+# Bourne Again Shell config file
+#
+# Wilfredo Sanchez Jr. | tritan@mit.edu
+# July 09, 1992
+#
+# MIT Project Athena
+#
+# ORIGINAL SOURCES: /usr/athena/lib/init/cshrc (ATHENA REL 7.3P)
+##
+
+ default_initdir=/usr/share/init
+default_bash_initdir=${default_initdir}/bash
+ user_initdir=~/Library/init
+ user_bash_initdir=${user_initdir}/bash
+
+if [ -r ${user_bash_initdir} ]; then
+ initdir=${user_initdir}
+ bash_initdir=${user_bash_initdir}
+else
+ initdir=${default_initdir}
+ bash_initdir=${default_bash_initdir}
+fi
+
+# SET UP HOST-DEPENDANT VARIABLES, ETC.
+
+host=$(echo $(hostname) | tr A-Z a-z)
+
+user=`whoami`
+
+export HOST=${host}
+export USER=${user}
+
+# User ID
+if [ -z "${uid}" ]; then uid=$(id | cut -d = -f 2 | cut -d \( -f 1); fi
+
+# SET COMMAND SEARCH PATH AND MAN PATH
+if [ -f ${bash_initdir}/path ]; then source ${bash_initdir}/path; fi
+
+# ENVIRONMENT SETUP
+
+if [ -n "${PS1}" ]; then interactive="YES"; fi
+
+if [ -z "${ENV_SET}" ]; then
+ if [ -f ${default_bash_initdir}/environment ]; then
+ #echo "Initializing environment..."
+ source ${default_bash_initdir}/environment
+ fi
+fi
+
+if [ -r ${default_bash_initdir}/bash.defaults ]; then
+ source ${default_bash_initdir}/bash.defaults
+fi
+
+# DEFAULT LOGIN SOURCES
+if [ -f ${bash_initdir}/rc.mine ]; then source ${bash_initdir}/rc.mine; fi
+
+if [ "${interactive}" = "YES" ]; then
+ # These aren't useful for non-interactive sessions
+ if [ -f ${default_bash_initdir}/aliases ]; then
+ source ${default_bash_initdir}/aliases
+ fi
+fi