@Caleb ha ragione a fare in modo che lo script verifichi solo il collegamento simbolico. Tuttavia, la parte sul perché è stata lasciata fuori ed ero curioso. Se guardi il codice sorgente di coreutils e traccia l'output del test puoi vedere che quando esegui il test del link simbolico usa lstat e se stai usando il test -f in realtà chiama 'stat' che segue il link simbolico:
$ ln -s varnish_config XXX
$ strace -s 2000 test -L XXX 2>&1 | grep XXX
execve("/usr/bin/test", ["test", "-L", "XXX"], [/* 47 vars */]) = 0
lstat("XXX", {st_mode=S_IFLNK|0777, st_size=14, ...}) = 0
$ strace -s 2000 test -L varnish_config 2>&1 | grep varnish
execve("/usr/bin/test", ["test", "-L", "varnish_config"], [/* 47 vars */]) = 0
lstat("varnish_config", {st_mode=S_IFREG|0664, st_size=1046, ...}) = 0
$ strace -s 2000 test -f XXX 2>&1 | grep XXX
execve("/usr/bin/test", ["test", "-f", "XXX"], [/* 47 vars */]) = 0
stat("XXX", {st_mode=S_IFREG|0664, st_size=1046, ...}) = 0
Dalla pagina man di stat:
stat() stats the file pointed to by path and fills in buf.
lstat() is identical to stat(), except that if path is a symbolic link,
then the link itself is stat-ed, not the file that it refers to.
Ciò significa che il test -f restituirà true fintanto che il nome file specificato è un collegamento simbolico a un file normale o a un file normale stesso.
-eed-fera che-eera usata per sapere se esisteva un file (di qualsiasi tipo) ed-fera specificamente per verificare se il file esisteva ed era un file normale. Sembra che ho capito male che cosa fosse un "file normale" ...