home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.shell
- Path: sparky!uunet!mcsun!sunic!aun.uninett.no!ugle.unit.no!news
- From: Harald.Eikrem@delab.sintef.no
- Subject: Re: sh equivalent of csh's `source` wanted
- Message-ID: <1992Jul31.162504*Harald.Eikrem@delab.sintef.no>
- Sender: news@ugle.unit.no (NetNews Administrator)
- Organization: SINTEF DELAB, Trondheim, Norway.
- References: <ericw.712530389@hobbes> <1992Jul31.082929.8331@prl.dec.com>
- <1992Jul31.123358.795@usenet.ins.cwru.edu> <Bs931H.Dpv@news.cso.uiuc.edu>
- Date: 31 Jul 92 16:25:04
- Lines: 12
-
- Anybody ever wondered about the csh (or better tcsh) equivalent of the Bourne
- shell `.' ? Although I will not recommend its usage, this works:
-
- # a 'source' command that scans $path for files with execute access, which
- # may fail desperately if the file isn't in a csh "sourceable" state:
- alias psource 'if "\!*" == "" eval "echo -n p; source"; set _f=(`which \!*`); if $#_f == 1 source "$_f"; if $#_f != 1 echo psource: "\!*": Command not found.; unset _f'
-
- # a 'source' command that first looks for a direct path to the file to be
- # sourced, then tries $path:
- alias . 'if "\!*" == "" source; if -f "\!*" source "\!*"; if ! -f "\!*" eval "psource \!*"'
-
- :) ~~harald E.
-