home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!news.encore.com!mpalmer
- From: mpalmer@encore.com (Mike Palmer)
- Subject: csh equivalent of ksh function?
- Sender: news@encore.com (Usenet readnews user id)
- Message-ID: <BtC1LI.o3@encore.com>
- Date: Fri, 21 Aug 1992 12:05:41 GMT
- Nntp-Posting-Host: sysgem1.encore.com
- Organization: Encore Computer Corporation
- Lines: 27
-
- Thanks to all those who answered my "how to cd & stay" question. I ended up
- using a ksh function, but I'd like it to work in csh too.
-
- I have the following ksh function that allows the "sdx" program to select
- a directory to change to and write the name in the home directory file:
- _t_e_m_p_. The function then does a cd to that directory. (This is the basis
- of an smart directory changer.)
-
- sd()
- {
- sdx $@
- if test -f ${HOME}/_t_e_m_p_
- then
- cd `cat ${HOME}/_t_e_m_p_`
- rm ${HOME}/_t_e_m_p_
- fi
- }
-
- The simpler form "cd `sdx $@`" suggested by most, won't work because sdx
- sometimes asks the user which directory he want's to move to.
-
- What would be the best way to do this in csh?
-
- Regards,
- Mike palmer
- Telephone: (305) 797-2326 (W) (305) 7546-3146 (H)
-
-