Hacker News new | past | comments | ask | show | jobs | submit login

$( allows any syntax until a non-escaped ). It's Command Substitution[1], and they run in "subshells".

    echo hello "$(
        echo hello \
        | sed 's,hello,world,g'
    )"
[ is an actual binary file that gets invoked, called test. You can "man [" or "man test" to learn about all of its uses.

I use [ exclusively, but with && and ||, instead of -a and -o respectfully.

e.g. [ -e "$file" ] && [ -w "$file" ] instead of [ -e "$file" -a -w "$file" ].

[1] http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: