Bash fail use file descriptor assigned a file that resides in /tmp
Does one experienced too that
Bash cannot use file descriptor assigned a file that resides in /tmp ? i.e. inside script: Code:
... ... bash: /tmp/dls1: Permission denied While the second file is read into f2 works. Please advise the wisest solution |
Code:
exec 3< <(/tmp/dls1) Code:
#!/bin/bash |
@OP Are these synonyms or not? If not, what is the difference?
Code:
exec 3</tmp/dls1 |
Quote:
It can be a real permission issue (permission is really denied), but I think you missed the cat in the first line. Code:
exec 3< <(cat /tmp/dls1) Additionally would be better to use shellcheck to catch errors like this. |
Quote:
|
Quote:
Code:
exec 3</tmp/dls1 |
Not a synonym,
but much more complex, and yes, with the same result. Further, a lasting open with exec (until there is a close with another exec) is more complicated than redirecting a code block a la post#2 The loop is a code block; when redirected then the open occurs when the code block starts, and the close occurs when the code block ends. BTW a { } forms a custom code block: Code:
{ |
All times are GMT -5. The time now is 11:00 PM. |