"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 ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: "Ambiguous redirect" error on a simple shell script

  1. "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



  2. 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.

  3. 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

+ Reply to Thread