Twitter Updates

    follow me on Twitter

    G-AVLN in front of her home

    G-AVLN in front of her home

    Mostly Unix and Linux topics. But flying might get a mention too.

    Thursday, September 29, 2005

    Playing with pdksh redirection

    We often test the understanding of the command line scan by asking if the following will work:

    $ > /tmp/file1 2> /tmp/file2 (*)

    This week, been faced with questions exploring this further. For example, notice that:

    $ >log ( ps; who; df )

    will work, so will

    $ > log10 < /etc/hosts (while read -r line; do print $line; done )



    (*) It will (as long as file exists). The shell opens all three files during the scan, and cat will be the only word remaining on the command line. In simple terms. the shell will look after the 'connectivity' between cat's I/O streams and the files.

    No comments:

    Blog Archive