[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with echo ....

From: Richard Dawe
Subject: Re: Problem with echo ....
Date: Wed, 08 Jan 2003 09:07:50 +0000


"Raghu Kumar Y." wrote:
>                 We have shell scripts which works on Digital, SunOS and AIX
>                 machines. Recently we ported our scripts on Linux machine.
>                 On Linux machine echo is behaving differently because of
>                 this we are facing some problems.
>                 i.e
>                 echo "raghu\tkumar"
>                 raghu\tkumar
>                 Same command on SunOS giving "raghu   kumar" output.
>                 On Linux machine we need to use -e switch to expand
>                 backslash-escape characters which is not there in other
>                 machines.
>                 When  I modified echo.c source and  uncommented line no 53
>                 (#define V9_DEFAULT), then it is working fine.
>                 Please confirm this modifications is correct or not.

That depends on what you want 'echo "raghu\tkumar"' to display. I'm assuming
that you want it to output a tab. If so, why not just embed a tab in the
string? That avoids having to modify echo on every Linux box you'll ever want
to run the script on.

Or you could implement a run-time test:

    if uname | grep -i linux >/dev/null 2>&1; then
        ECHO="echo -e";

and then use $ECHO in all places.


Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

reply via email to

[Prev in Thread] Current Thread [Next in Thread]