sattu
sattu

Reputation: 650

"ambiguous redirectine" while redirecting the output from shell script

demo.sh has following line:

. ./one.sh  > ../Results/myResult.txt 2>&1

when i run ./demo.sh it is giving:

ambiguous redirectine 1: 1

But the myResult.txt gets created at appropriate location with size 0 KB.

If i remove the redirection of output, it script works fine. What is wrong with my script? I have gone through Ambiguous output redirect on solaris, shell script ambiguous redirect, ambiguous redirect - file gets created. Nothing helped though.

Upvotes: 1

Views: 224

Answers (1)

Josh Kelley
Josh Kelley

Reputation: 58352

If you're saving your script with DOS-style line endings (CRLF instead of LF), that can produce all of the symptoms you're seeing.

Change the line endings using the text editor or command-line utility of your choice, then try again.

Upvotes: 1

Related Questions