Gabor Z. Papp wrote: > Hello, > > $ bash --version > GNU bash, version 4.0.17(1)-release (i686-pc-linux-gnu) > Copyright (C) 2009 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later > <http://gnu.org/licenses/gpl.html> > > This is free software; you are free to change and redistribute it. > There is NO WARRANTY, to the extent permitted by law. > > $ ls -l /bin/sh > lrwxrwxrwx 1 root root 4 Apr 27 08:51 /bin/sh -> bash > > $ cat bla > #! /bin/sh > cd /tmp > rm -f aaaa > echo "id" > aaaa > if [ -f "aaaa" ]; then echo "sourcing aaaa"; . aaaa; fi > > $ ./bla > sourcing aaaa > ./bla: line 5: .: aaaa: file not found > > $ bash ./bla > sourcing aaaa > uid=101(gzp) gid=101(gzp) > groups=101(gzp) > > Is this "file not found" problem known in bash4?
This is a property of bash's posix mode, which bash uses when run as `sh'. The manual says, in the section describing posix mode: The . and source builtins do not search the current directory for the filename argument if it is not found by searching PATH. If you don't have `.' or the current directory in $PATH, the shell won't find the file to source. Posix says: If file does not contain a <slash>, the shell shall use the search path specified by PATH to find the directory containing file. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/