RajSanpui
RajSanpui

Reputation: 12094

How to port this bash script to sh?

This works:

#!/bin/bash
while read system_name mount_name
do
   echo "${system_name} ${mount_name}"
done < <(echo "select system_name, mount_name from SystemTable" | mysql ifm -uroot -pinsite3)

But this does not if i change the shebang variable to #!/bin/sh How to make the above script work in sh shell?

Upvotes: 1

Views: 291

Answers (1)

Joe
Joe

Reputation: 31087

Perhaps:

#!/bin/sh

echo "select system_name, mount_name from SystemTable" | mysql ifm -uroot -pinsite3 |
while read system_name mount_name
do
   echo "${system_name} ${mount_name}"
done

Upvotes: 2

Related Questions