If I do this:
so say at the command line I have:
myapp -f <(cat)
when I run it I get this error:
You need to pass a file after the -f flag. The resolved file path was: '/dev/fd/63'. This path did not appear to exist on the filesystem.
How can I determine if the result of the process substitution is an actual file (for validation purposes)? Here is my bash code which generated the error:
if [[ -L "$file_path" ]]; then file_path="$(readlink "$file_path")"; fi if [[ ! -f "$file_path" ]]; then echo "You need to pass a file after the -f flag. The resolved file path was: '$file_path'. This path did not appear to exist on the filesystem".; return 1; fi
if I get rid of my validation, code, I get this:
Could not open the following file for reading: /dev/fd/63 EBADF: bad file descriptor, open '/dev/fd/63'
The node.js code I am using to read from the path is:
const fd = fs.openSync(file_path, 'r'); fs.read(fd, ...);