Question on bash script

I have some questions while digesting a bash script :

#1 does the line read the output from SQL and store in variable jobs
#2 does the line read the output from SQL and store in variable dbdata ?
      Why the syntax is different from #1
#3 What is the purpose of IFS="$( echo -e '\t' )" ? What does this line do ?



#1 read -ra jobs <<< $(SQL -h$SQL_HOST -u$SQL_USR -p$SQL_PWD cms -e "select id from Job where status='Pending' order by id;" | sed "1 d")

for ID in "${jobs[@]}";
do
  echo "ID=$ID" | tee -a ${_LOG}

  #2 dbdata=`SQL -h$SQL_HOST -u$SQL_USR -p$SQL_PWD cms -e "select * from Job where id=$ID;" | sed "1 d"`

  SAVEIFS=$IFS
  #3 IFS="$( echo -e '\t' )" read -ra jobinfo <<< "$dbdata"
  IFS=$SAVEIFS

  DOMAIN=${jobinfo[0]}
 :
 :
done
AXISHKAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TintinCommented:
1)  Yes

2)  Yes.   The syntax is different, but the result is the same.

Originally, to capture the output of a command, you needed to use backticks, eg:

result=`somecommand`

In newer shells, that syntax was superceded by  $(), eg:

result=$(somecommand)

The $() format is much easier to read as backticks can look like single quotes if you don't look carefully.


3)  This is an odd way of setting the IFS (Internal Field Separator) variable to a tab.  

It's the same as doing

IFS="\t"

This means that tabs are recognised as the separator between fields.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.