Comments (4)
  • Add a Comment
  • Edit
  • More Actions v
  • Quarantine this Entry

1 KrausWol commented Permalink

Do NOT use backticks! Instead use $(). Backticks have some disadvanteges, read more here: http://mywiki.wooledge.org/BashFAQ/082

2 Himanshuz.chd commented Permalink

@KrausWol <br /> Thanks a lot for the valuable information.

3 geohump commented Permalink

I would like to add something to what Kraus Wol said. <div>&nbsp;</div> As he said $( some command) is a better way to go than the backticks. <div>&nbsp;</div> One reason why is nesting. Backticks can't be nested. $() can. <div>&nbsp;</div> Example: <br /> echo Your next appointment is at $(egrep "Appointment time" $(grep bob $MyFile | awk '{print $5 }'; ) | sed -e 's/^appoint[^:]*://') <div>&nbsp;</div> The demo is a bit contrived, but it is not more complex then things people find themselves doing.

4 Himanshuz.chd commented Permalink

@geohump <br /> I agree, using $() is a better practice as nesting is a useful feature. Your example could be a bit complex for some people though. :-)