这有效:
#!/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中工作?
答案 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