Thanks in advance,
Kee Chua
Put the following line in ur .tcshr or .cshrc file.....
alias pwd 'echo "$cwd"'
Yoonsik
--
Yoonsik Cheon, ch...@cs.iastate.edu
I noticed that too. I had to do an alias of:
alias pwd 'PWD'
or something like that.
Brian
> Put the following line in ur .tcshr or .cshrc file...
> alias pwd 'echo "$cwd"'
Echoing $cwd is certainly the best advice for interactive use. But
it's probably also good to have a /usr/bin/pwd or /bin/pwd so that
shell scripts that require it will run without modification. Also,
I like to have a pwd command that returns the absolute current path
without symbolic links. The standard approach we've seen in
Linux/SLS is to have an executable bash script with the contents:
#!/bin/bash
pwd
If you want one that does not require the presence of any particular
shell, as I prefer, then the following program is maybe a more
'standard' way of doing it:
/* ---- pwd.c ----
*
* To build: cc -O -N -s pwd.c -o pwd
*/
#include <stdio.h>
#include <unistd.h>
main()
{
char buffer[4096]; /* I think 4K is correct the limit for Linux */
printf("%s\n", getwd(buffer));
return(0);
}
I have written a small program pwd:
/*
* pwd for Linux
*
* Siegen, 29.01.93
*/
#include <stdio.h>
char *cwd, *getcwd();
main() {
if ((cwd = getcwd((char *)NULL, 256)) == NULL) {
perror ("pwd");
exit (1);
}
printf("%s\n", cwd);
}
--------------------------------------------------------------------------
Ralf Dreier | Universitaet-GH-Siegen
| Institut fuer
email dre...@fb5.uni-siegen.de | Wirtschaftsinformatik
Phone 49 271/740-3262 | Hoelderlinstr. 3
Fax 49 271/740-2310 | D-W-5900 Siegen, Germany
Well, that works well, but what about shells that don't store the current
working directory in the environment (i.e. rc). The Berzerkeley 'pwd'
program from your nearest bsd-net2 site compiles out of the box (Not
surprising, since it's only about 20 lines).
On a related note, has anyone ported the net2 Bourne shell clone? Bash is
nice as an interactive shell, but as a quick scripting language it can be
kind of overkill.
ja. Mentally Contaminated, and *DAMN* proud of it.
--
Suicidal Cyko Joe Ammond amm...@gdls.com
Unix System Administrator Computer Sciences Corporation
"your will to speak clearly/exposed too much
unsung once to often/could not rub off" -Helmet