l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
January 6: Social gathering
Next Installfest:
TBD
Latest News:
Nov. 18: Club officer elections
Page last updated:
2001 Dec 30 17:12

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] xterm question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] xterm question



On Sun, Oct 21, 2001 at 11:14:34AM -0700, Peter Jay Salzman wrote:
> cd()
> {
> 	cd $1
> 	xttitle `pwd`
> }
> 
> this is actually an infinite loop.   i'd much prefer to use "cd" rather than
> a homebrewed function to change directories

man bash
[snip]
       builtin shell-builtin [arguments]
              Execute the specified  shell  builtin,  passing  it
              arguments,  and  return  its  exit status.  This is
              useful when defining a function whose name  is  the
              same  as a shell builtin, retaining the functional­
              ity of the builtin within  the  function.   The  cd
              builtin is commonly redefined this way.  The return
              status is false if shell-builtin  is  not  a  shell
              builtin command.
[snip]

eg:
  cd () { builtin cd $1; test -n "$DISPLAY" && xttitle $PWD }

test -n will ensure you don't waste clock cycles when not running under X.

Using $PWD rather than `pwd` will run faster.  Useful during swapping when
you'd really rather have your root prompt come right back while you try to
regain control of an errant process.

hope that helps.

I've personally found that fancy prompts are usually a liability for a
sysadmin.  They are nice when not running as root though...

-- 
Ted Deppner
http://www.psyber.com/~ted/



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
EDGE Tech Corp.
For donating some give-aways for our meetings.