i want to check the readability of a file inside the script.
when i use
if [ ! -r $sourcef ]
then
echo the file "$sourcef" is not readable
else
echo something
fi
i am getting the error : f: unknown test operator
when i tried to check the availability with
if [ ! -f $fname ]
i was getting the same error and methyl suggested me to use
if [ ! -e $fname ]
its because
The test "-e" is not valid in "ksh". It is valid in POSIX shells such as bash
so, can someone plz tell me what to use for the readbility
Posix test.
Ksh93 download.
Many of the *nix include only old ksh (=ksh88) = Posix done after ksh88. Ksh93 test include your -e option.
I think that dash is only Posix full compatible. Include all posix features and nothing else.
Ksh93 include also Posix but it has also some extension, like bash and many others.
---------- Post updated at 11:45 AM ---------- Previous update was at 11:42 AM ----------
if [ -r "$fanme" ] or if [ -r "$fname" ] ?
My test -r works fine - testing have I read access or not.