From: John P . Looney (valen at domain tuatha.org)
Date: Wed 20 Oct 1999 - 11:41:36 IST
Thought I'd post a few more handy little tips, in the hope people would
post theirs:
I've included something for your ~/.bashrc or ~/.kshrc - it's a simple
unarc shell function, so that you can do stuff like:
$ cd ~/unarc
$ unarc ~/thing.zip ~/linux-2.2.12.tar.gz
Unarchiving pkzipped file thing.zip ...
Unarchiving gzipped file linux-2.2.12.tar.gz
Done in 34 seconds.
$
Here is my prompt (view it: http://www.RedBrick.dcu.ie/~valen/kates.gif).
It's got pretty colours, based loosely on the rasterman's one, and prints
the username, hostname, and directory into the titlebar of your terminal.
The important bit, I suppose is that you can use the following escape code
to set a terminals' titlebar:
^[]2; title ^G
So, it's escape, end-square-bracket, the numeral two, a semi-colon, and
then the text you want in the titlebar. To return to the terminal itself,
end with a control-G character. Easy!
Get annoyed with all the different audio formats around ?
# ln -s /dev/audio /dev/audio.au
Now, to play *any* sample:
$ sox sample.wac /dev/audio.au
Sorted :)
Now, some source:
# The source of the unarc shell function:
unarc () {
START=$SECONDS
for i in $*
do
if [ "`echo $i | grep bz2`" != "" ] ; then
echo Unarchiving bzipped tarfile $i...
nice bzip2 -dc $i | tar xf - 2>&1
elif [ "`echo $i | grep zip`" != "" ] ; then
echo Unarchiving pkzipped file $i...
nice unzip -q $i 2>&1
elif [ "`echo $i | grep tar.gz`" != "" ] ; then
echo Unarchiving gzipped tarfile $i...
nice gzip -dc $i | tar xf - 2>&1
elif [ "`echo $i | grep tgz`" != "" ] ; then
echo Unarchiving gzipped tarfile $i...
nice gzip -dc $i | tar xf - 2>&1
elif [ "`echo $i | grep tar.Z`" != "" ] ; then
echo Unarchiving gzipped tarfile $i...
nice gzip -dc $i | tar xf - 2>&1
else
echo Unarchiving tarfile $i...
nice tar xf $i`
fi
done
echo Done in `expr $SECONDS - $START` seconds.
} # end unarc
The source for my prompt:
GRAD1='\333\262\261\260'
GRAD2='\260\261\262\333'
YLOBRN='\033[01;33;43m'
WHTBRN='\033[01;37;43m'
REDBRN='\033[00;31;43m'
REDBLK='\033[00;31;40m'
BLKRED='\033[00;37;41m'
PPLBLK='\033[01;35;40m'
WHTBLK='\033[01;37;40m'
NONE='\033[00m'
E='\['
R='\]'
PS1='^[]2; \u on \h in \w ^G'${E}${WHTBRN}' '${R}${E}${REDBRN}${GRAD2}${BLKRED}' \u : \h : \w/ '${REDBLK}${GRAD1}${WHTBLK}${R}' \d \t '${E}${NONE}' \n'${PPLBLK}${R}'\h ['${?}'] '${E}${NONE}${R}' '
Anyone else want to post some convienence stuff to the list ?
Kate
-- Microsoft. The best reason in the world to drink beer. http://www.redbrick.dcu.ie/~valen
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:04:45 GMT