即使创建了输出文件,我也会收到一条不明确的重定向消息。
我的 sh 脚本
#!/bin/bash
# you can use read or VAR="$1" to setup these variables
SERVER_IP=
SERVER_PORT=
LANGUAGE_URL=
PROJECT_NAME=
while read f1
do
OUTPUTFIL=$f1
{
echo "<?xml version=\"1.0\" encoding=\"Shift-JIS\"?>"
echo "<flash_cfg>"
echo "<server ip=\"${SERVER_IP}\" port=\"${SERVER_PORT}\"/>"
echo "<language_url>${LANGUAGE_URL}</language_url>"
echo "<project_name>${PROJECT_NAME}</project_name>"
echo "</flash_cfg>"
} > ${OUTPUTFIL}
done < file
“文件的内容
out.xml
在跑步的时候
:~/Documents$ bash shell.sh
shell.sh: line 22: ${OUTPUTFIL}: ambiguous redirect
然而,文件 out.xml 被创建