"Ambiguous redirect" error on a simple shell script - Help
This is a discussion on "Ambiguous redirect" error on a simple shell script - Help ; Hi everyone,
When I run the following shell script I get an "ambiguous redirect" error
message; specifically, "ambiguous redirect1", and I can't figure out why.
Here are the contents:
######################
#/bin/bash
echo "hello" >> ./test.log 2>&1
#######################
That's it. Pretty ...
-
"Ambiguous redirect" error on a simple shell script
Hi everyone,
When I run the following shell script I get an "ambiguous redirect" error
message; specifically, "ambiguous redirect1", and I can't figure out why.
Here are the contents:
######################
#/bin/bash
echo "hello" >> ./test.log 2>&1
#######################
That's it. Pretty short one.
I'm using RedHat Linux, recent version, maybe a few months old.
Seems the shell doesn't like my "2>&1" for whatever reason, but when I tried
the same script on Solaris I had no problems? If you have any tips I'd be
grateful. Thanks.
-Jim
-
Re: "Ambiguous redirect" error on a simple shell script
On Wed, 19 May 2004 13:58:29 -0700, Jim Bancroft wrote:
> Hi everyone,
>
> When I run the following shell script I get an "ambiguous redirect" error
> message; specifically, "ambiguous redirect1", and I can't figure out why.
>
> Here are the contents:
>
> ######################
> #/bin/bash
> echo "hello" >> ./test.log 2>&1
> #######################
You meant
#!/bin/bash
Or, if you want it portable
#!/bin/sh
which will work on non-linux varieties as well as linux.
-
Re: "Ambiguous redirect" error on a simple shell script
#!/bin/sh needs to be on the first line as well so you should remove the first line of comments