LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] more handy tips...

[ILUG] more handy tips...

John P . Looney valen at tuatha.org
Wed Oct 20 11:41:36 IST 1999


 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




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell