[cs631apue] Relative path of redirection

Jan Schaumann jschauma at stevens.edu
Mon Dec 14 21:12:54 EST 2015


jwang81 <jwang81 at stevens.edu> wrote:
 
> Do we need to support relative path of file for redirection?
> e.g echo "hello" > newfile

Yes.  Any pathname, absolute or relative, is possible.

This should not in any way complicate your program.  All you need to do
is (try to) open the given file.  Passing a relative or an absolute
pathname to open(2), for example, makes no difference, and open(2) would
do the right thing.

Or is there a scenario where using either an absolute or a relative path
would make things more complicated that I'm not considering?

-Jan


More information about the cs631apue mailing list