On 3/19/19 4:21 AM, furrymc...@lippydanger.jumpingcrab.com wrote: > > Good morning, > > In GNU bash, version 5.0.2(1)-release (x86_64-pc-linux-gnu): > The command cd "" is successful but cd -P "" fails. > This is inconsistent and not evident in man bash. > Expected is that cd "$(mktemp -d)" returns error if mktemp fails.
This is a consequence of the pathname canonicalization that takes place using the supplied argument, because the -L option is the default. Pretty much every POSIX-conformant shell behaves like this. > The return value is true if the directory was successfully > changed; false otherwise. After canonicalization, it's equivalent to cd $PWD, which is successful. The -P option forces an attempt to cd to "" directly, which fails because chdir(2) fails with ENOENT when its argument is the empty string. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/