Results 1 to 3 of 3

Thread: bash: what do these parentheses mean?

  1. #1
    Join Date
    Mar 2007
    Beans
    763

    bash: what do these parentheses mean?

    Hi,

    I would like to understand the following code better:
    Code:
    diff <(du -ab | sort) <(du -ab directory2 | sort)
    (source url) http://ubuntuforums.org/showthread.php?t=883491

    Is there a name for the function that the parentheses accomplish?

    My interpretation is that the parentheses act as a substitute for where normally a filename would be. Is there a place I can read more about these parentheses and double <'s ?

    Thanks.

  2. #2
    Join Date
    Oct 2008
    Location
    /home/brad
    Beans
    591
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: bash: what do these parentheses mean?

    The parentheses I believe act as an execution point - meaning that bash executes the command in parentheses - "du" stands for disk usage - and then substitutes that in. So what this is doing is comparing the disk usage of two directories. not specifying a directory in the first section (du -ab) means that it uses the current directory.
    Correct me if I'm wrong, but I'm relatively confident that I'm not.
    Windows free as of 11/18/2008.
    Feel free to message me on Skype if you have questions on anything. I'm happy to help!
    Note: If things don't work, try this: Reboot. Check all wires. Check Again.

  3. #3
    Join Date
    Mar 2006
    Beans
    199

    Re: bash: what do these parentheses mean?

    Normally, commands within parentheses execute within a subshell. The < signs are input redirection. In this example, these are combined into what is known as process substitution.

    For a good source of information on bash scripts, see the The Advanced Bash Scripting Guide.
    Last edited by supirman; August 18th, 2009 at 02:11 AM. Reason: added process substitution

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •