#!/bin/bash echo 123456789 > out.txt exec 3<> out.txt read -n 4 <&3 echo -n 5 >&3 exec 3>&- Was asked the content of out.txt at the end of script, in an interview written exam. I did run the script afterwords and it gave me 123456789. Yet I have no idea what is going on in the script, especially the parts with the exec statements. I looked up the manpage and google search results for exec and could not find anything on the 3<> bit. Could somebody, well versed in shell scripting, explain what is going on here?
echo "$REPLY"anywhere after the line with thereadcommand and run it. you should1234which is what the-n4does