Você pode apenas fazer:
case $1 in (/*) pathchk -- "$1";; (*) ! : ;; esac
Isso deve ser o suficiente. E ele gravará diagnósticos para stderr e retornará a falha por componentes inacessíveis ou inacessíveis. pathchk não é sobre os nomes existentes - é sobre < em> usáveis nomes de caminho.
The
pathchkutility shall check that one or more pathnames are valid (that is, they could be used to access or create a file without causing syntax errors) and portable (that is, no filename truncation results). More extensive portability checks are provided by the-poption.By default, the
pathchkutility shall check each component of eachpathnameoperand based on the underlying file system. A diagnostic shall be written for eachpathnameoperand that:
Is longer than
{PATH_MAX}bytes (see Pathname Variable Values in <limits.h>)Contains any component longer than
{NAME_MAX}bytes in its containing directoryContains any component in a directory that is not searchable
Contains any character in any component that is not valid in its containing directory
The format of the diagnostic message is not specified, but shall indicate the error detected and the corresponding
pathnameoperand.It shall not be considered an error if one or more components of a
pathnameoperand do not exist as long as a file matching thepathnamespecified by the missing components could be created that does not violate any of the checks specified above.