command substitution doubt

Hi,

I almost always use back quotes in scripts to assigin output of a command to a variable.
eg: file=`basename a/b/c/d/file`
year_mon=`date +%Y%m`

But the same can be achieved like:
file=$(basename a/b/c/d/file)
year_mon=$(date +%Y%m)

I would like to know if there is any advantage/disadvantage or performance issues for these methods. or Is it Ok to use any of these?

Thanks in advance!

See if this gives any information you're looking for:
Useless use of backticks.

1 Like

BashFAQ/082 - Greg's Wiki

1 Like

Oh.. Thanks a lot for that itkamaraj. :b: I need to switch to $() :slight_smile:

---------- Post updated at 10:29 AM ---------- Previous update was at 10:28 AM ----------

Thank you Balajesuri...