bash: Duplicate an input file descriptor.



  • Take into account the main readme for this section. README first.

    The contents of oneworld file is.

    One nation under a groove
    

    Open file descriptor 3 for input and read file oneworld.

    $ exec 3< oneworld
    

    Copy input file descriptor 3 to input file descriptor 4.

    $ exec 4<&3
    

    Confirm file descriptor 4 has a copy of file descriptor 3.

    $ cat <&4
    One nation under a groove
    

Log in to reply
 

© Lightnetics 2024