LINUX.ORG.RU

История изменений

Исправление Eddy_Em, (текущая версия) :

Ничего такого у меня не пишет:

lrwxrwxrwx 1 eddy eddy      5 июля  30 14:19 aa -> asdfd
file asdfd
asdfd: ERROR: cannot open `asdfd' (No such file or directory)
readlink aa 
asdfd
Тест можно так, например, делать:
[ -e $(readlink aa) ] && echo "file/dir exists" || echo "link is incorrect"
:
[ -e $(readlink aa) ] && echo "file/dir exists" || echo "link is incorrect"
link is incorrect

touch asdfd

[ -e $(readlink aa) ] && echo "file/dir exists" || echo "link is incorrect"
file/dir exists

rm asdfd 
rm: удалить пустой обычный файл <<asdfd>>? y

mkdir asdfd

[ -e $(readlink aa) ] && echo "file/dir exists" || echo "link is incorrect"
file/dir exists

Но, как уже выше сказали, можно просто

[ -e aa ] && echo "file/dir exists" || echo "link is incorrect"

Исходная версия Eddy_Em, :

Ничего такого у меня не пишет:

lrwxrwxrwx 1 eddy eddy      5 июля  30 14:19 aa -> asdfd
file asdfd
asdfd: ERROR: cannot open `asdfd' (No such file or directory)
readlink aa 
asdfd
Тест можно так, например, делать:
[ -e $(readlink aa) ] && echo "file/dir exists" || echo "link is incorrect"
:
[ -e $(readlink aa) ] && echo "file/dir exists" || echo "link is incorrect"
link is incorrect

touch asdfd

[ -e $(readlink aa) ] && echo "file/dir exists" || echo "link is incorrect"
file/dir exists

rm asdfd 
rm: удалить пустой обычный файл <<asdfd>>? y

mkdir asdfd

[ -e $(readlink aa) ] && echo "file/dir exists" || echo "link is incorrect"
file/dir exists