alias l="ls -la|more"
alias r="ls -latr"
alias ldir="ls -la | egrep '^d'"
alias t=less
alias md=mkdir
alias ex=exit
Tuesday, September 27, 2011
Standard Bash Aliases
Thursday, January 13, 2011
Bash Prompt
Here is my favorite PS1 variable setting for the bash prompt:
export PS1="\! \u@\h \D{%Y-%m-%d} \t \w:-)"
Comment:
export PS1="\! \u@\h \D{%Y-%m-%d} \t \w:-)"
Comment:
:-) - a smiley for a happy day!And here is an example how the output looks like:
\w - full working directory, an absolute necessity.
\D{%Y-%m-%d} \t - short iso date and current time including seconds.
\u@\h - who are you, and where... could be quite expensive to get this wrong.
\! - look up the bash documentation for the !<hist number> history expansion feature to conveniently reuse previous commands or command parameters. With \! in the prompt you need the history command less to look up previous commands, but otherwise ommit this information in the prompt if your prompt line has already become too wide.
237 clemens@gavrilov 2011-01-13 19:43:44 ~/dev/src:-)echo 'hi'For original documentation check "man bash" and jump to the PROMPTING section.
hi
238 clemens@gavrilov 2011-01-13 19:43:48 ~/dev/src:-)
Saturday, January 1, 2011
Shell Script App Dir
#! /bin/sh
if [ "$APPHOME" = "" ] ; then
# try to locate application home directory
## resolve links - $0 may be a link to the app home
PRG=$0
progname=`basename $0`
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname $PRG`/$link"
fi
done
export APPHOME=`dirname "$PRG"`/..
export APPHOME=$(cd $APPHOME >/dev/null; pwd)
fi
Subscribe to:
Posts (Atom)