Two simple questions

Mike Coleman mkc+dated+1031589872.d0dff2 at mathdogs.com
Sun Aug 25 16:29:59 CDT 2002


rod holcomb <rholcomb12001 at yahoo.com> writes:
> ONE:
> Can I change the current working directory from within a gawk program
> using  something like:
> 
> 	str6= “name_of _subdirectory”;
> 	system (“cd  “    str6);
> 
> I can’t seem to get it to work. Nor does
>        system ("cd ..");

This won't work because 'system' will execute commands in a subshell, and
changing the current working directory of the subshell won't affect that of
the parent (which is executing the awk program).

There would have to be a command in gawk to cd.  I don't see one.  In any
case, if your awk program is longer than 100 lines, you'd probably be better
switching to Python.

> TWO:   
> Should I be able to make a symbolic link:     where both files 
> “pointer”  and “pointee”  are in the same directory  but I create the
> link while in another directory.     I know this is really must be
> really  basic but I can’t  seem to make it work.  The “pointer” file
> always seems to end on in the current working directory or it doesn’t
> point to “pointee”  correctly .     I did have some luck if I tried
> hard links but I would rather have smbolics

Yes.  I think the other post had the answers.




More information about the Kclug mailing list