-1

I see in a shell script code like:

for i in $(seq 1 5); do
  # do something
done

I am used to writing same logic as:

for i in `seq 1 5 | xargs`; do
  # do something
done

Is there a difference between both the approaches?

Subhash Chandran
  • 1,275
  • 1
  • 13
  • 20

1 Answers1

0

This $() approach seems to be the modern approach as it supports nesting. More details here: http://mywiki.wooledge.org/BashFAQ/082

Subhash Chandran
  • 1,275
  • 1
  • 13
  • 20