|
From: Petr M. <mi...@ph...> - 2006-03-10 07:56:21
|
>> fileexist(name)=\
>> system(sprintf("bash -c \"if [ -a %s ]; then echo 1; else echo 0; fi\"", name))
>>
>> print fileexist('a')
>> print fileexist('aa')
>
> ierr = system("test -e 'a'")
> if (ERRNO) print "No such file"
How to make a function of it? I cannot figure it out:
fileexist(name)=((system("test -e 'ab'")!="!!!") && !ERRNO)
print fileexist('anything')
Unfortunately, neither works under wgnuplot_pipes.
> Didn't we start this whole discussion thread with comparisons of
> "find" vs. "test" and their use to check file existence or updates?
Then I have probably haven't figure it out how to write it in a portable
way.
---
PM
|