Author: Stan Eisenstat
Subject: Re: [Cs323] cd
Date: Tuesday, 17 Nov 2020, 06:52:48
> Message Posted By: Unknown > > why does "cd -p | cd -p" print the cwd once to stdout in Hwk5/bashLT? The output from the first "cd -p" is written to the pipe, not the orignal stdout. The second "cd -p" ignores its stdin and writes the current working directory to its stdout. The latter is what appears when you run the command. ===== > Shouldn't it never print out because its a pipeline? (i.e. nothing seems > to happen when I do "cd -p | cd" which follows the rule from the spec) No. Printing the current working directory has no effect on the parent shell and thus the rule does not apply. --Stan-PREV INDEX NEXT