-1

What mean brackets around command in the unix shell. For example:

mac: workdir$pwd
/Users/Alex/workdir
same output of this:
mac: workdir$(pwd)
/Users/Alex/workdir

What is the difference when I'm use brackets and don't use it? My really situation it is:

(CP)  /Users/Alex/workdir/xercesc/include/xercesc/util.

I'm trying to build xercesc for mac os, and take few troubles. And I'm trying to do some changes in make package.

Rubens
  • 14,478
  • 11
  • 63
  • 92
Alex
  • 1
  • 3
  • My problem is that I do not understand why can command will be listed in brackets. – Alex Aug 03 '13 at 17:15
  • I'm still unclear what your problem is. The example you've included doesn't seem to have any 'bracket' characters included. Are you referring to `(CP)` as the "the brackets"? Please clarify if you mean square brackets [..] or curly brackets {...}, OR ....some other kind of brackets? This isn't really a programming question, voting to move to superuser.com. Good luck. – shellter Aug 03 '13 at 19:37

1 Answers1

1

I have no idea what workdir is but $pwd does nothing at all unless $pwd is a variable that you set, and $(pwd) calls the command pwd in a subshell. The pwd command prints the current working directory.

For what it's worth, I wouldn't recommend setting using $pwd as a variable since it is a built-in POSIX command.

Lastly, these { } [ ] are brackets and these ( ) are parenthesis.

nullByteMe
  • 6,141
  • 13
  • 62
  • 99