bash: create a descriptor reading/writing from/to different files?
echo file1 > file1
echo file2 > file2
if i do now:
exec 6<> file1
i have a descriptor 6 opened for reading and writing from/to file1
so it will read "file1"
but i want something like this
exec 6< file1 6>file2
i need ONE descriptor which reads from a file if something is read from the descriptor and writes to another file if something is written to the descriptor
is there a wait to do this?
it would be perfect if it works only trough bash i/o redirection
if it doesn't work, it would be interesting to know why
for reproduction this seems ok
echo 1234567890 > File # Write string to "File".
exec 3<> File # Open "File" and assign fd 3 to it. (<< this is what i want to replace)
read -n 4 <&3 # Read only 4 characters.
echo -n . >&3 # Write a decimal point there.
exec 3>&- # Close fd 3.
cat File # ==> 1234.67890
|All times are GMT -5. The time now is 03:38 AM.|