Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个在 Linux 上完美运行的脚本,但是当试图让它在 UNIX 机器上运行时,有一个命令我似乎一辈子都无法转换,它...
IFS=\| read TableName DataBase Schema MD5Check<<< "$NextFile"
$NextFile 是在前面的代码行中创建的变量,它将包含 4 列,用 | 分隔。
它的 <<< 不受欢迎,但我只是找不到从 UNIX 中读取变量的替代方法。有什么帮助吗?
可移植的方法是:
IFS=\| read TableName DataBase Schema MD5Check<<EOF $NextFile EOF
但是如果你可以限制变量的范围(你可以,但你可能需要重构):
echo "$NextFile" | { IFS=\| read TableName DataBase Schema MD5Check # Inside the braces, the variables are defined }