如何将此bash脚本移植到sh?

时间:2014-01-16 12:04:22

标签: linux shell

这有效:

#!/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)

但是,如果我将shebang变量更改为#!/ bin / sh ,则不会 如何让上面的脚本在sh shell中工作?

1 个答案:

答案 0 :(得分:2)

也许:

#!/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