in reply to Re: Reverse engineering a file handle
in thread Reverse engineering a file handle
The caveats with the above answer:
When the above method works, it's not guaranteed to return the right name. More than one file name can have the same inode (rare), or a symbolic link might have been be used on the command line (common).
Wouldn't that take a long time on drive with many files? (common)
And there are times when the above approach (and all others) would fail: When STDIN and/or STDOUT isn't a file. STDIN and/or STDOUT could be associated with a pipe, a device, etc.
Can you possibly rewrite the script and caller to pass the file names as arguments? You could make the name arguments optional and use STDIN and STDOUT when no names are provided.
|
|---|