1

The following lines of code correspond to ambiguous redirect errors, respectively.

echo -e "\t<other>" >> $xml

echo "</direntry>" >> $xml

line 62: $xml: ambiguous redirect

line 76: $xml: ambiguous redirect

Looking around the site it seems that this problem stems from variables not having double quotes around them, but if I change $xml to "$xml" I get a no such file or directory error.

1 Answers1

2

Double-quote your variable which you are writing to, it is most likely because of the xml variable containing one or multiple spaces present. The double-quotes present preserves your variable value intact and does not let it undergo word-splitting.

echo -e "\t<other>" >> "$xml"
Inian
  • 80,270
  • 14
  • 142
  • 161
  • This does not work for me. It still results in bash: : No such file or directory and the variable has no space. – KNN Jul 01 '21 at 17:40