Korn Shell Srcipt Question

Korn Shell Srcipt Question

Post by Sanjeev Aggarw » Sat, 22 Jun 2002 07:50:19



Hi

I am wrote the following script in korn shell and its not working.

export PLATFORM=ssunos5
export ROOT=`pwd`
export MAKEFILE=$ROOT/config/$PLATFORM/sample.mk

if (! -e $MAKEFILE) then
        echo ""
        echo "ERROR: "
        echo ""
else
        export INI=$ROOT/config/$PLATFORM/set.ini

        echo "Platform: $PLATFORM"
        echo "    Root: $ROOT"
        echo "Makefile: $MAKEFILE"
        echo "     INI: $INI"
        echo ""
fi

=============

when I run this script I get the following error

ksh: -a:  not found

I tried using -e also instead of -a that also didn't help any help on
this will be highly appreciated.

Sanjeev

 
 
 

Korn Shell Srcipt Question

Post by j.. » Sat, 22 Jun 2002 07:54:53



> I am wrote the following script in korn shell and its not working.

> export PLATFORM=ssunos5
> export ROOT=`pwd`
> export MAKEFILE=$ROOT/config/$PLATFORM/sample.mk

> if (! -e $MAKEFILE) then

This isn't ksh syntax. Try

if [[ ! -e $MAKEFILE ]];then

Read the ksh man page.

 
 
 

Korn Shell Srcipt Question

Post by <dphil.. » Sat, 22 Jun 2002 08:46:55


You can also try man test, which will narrow the amount of man pages you
have to sort through.



> > I am wrote the following script in korn shell and its not working.

> > export PLATFORM=ssunos5
> > export ROOT=`pwd`
> > export MAKEFILE=$ROOT/config/$PLATFORM/sample.mk

> > if (! -e $MAKEFILE) then

> This isn't ksh syntax. Try

> if [[ ! -e $MAKEFILE ]];then

> Read the ksh man page.

 
 
 

Korn Shell Srcipt Question

Post by j.. » Sat, 22 Jun 2002 08:54:40



> You can also try man test, which will narrow the amount of man pages
> you have to sort through.

That assumes you'd be using the "test" syntax, rather than what's in
the thread. It seems better to me to understand the inherent
capabilities of the shell in question.

Joe

P.S. Please don't top-post.




> > > I am wrote the following script in korn shell and its not working.

> > > export PLATFORM=ssunos5
> > > export ROOT=`pwd`
> > > export MAKEFILE=$ROOT/config/$PLATFORM/sample.mk

> > > if (! -e $MAKEFILE) then

> > This isn't ksh syntax. Try

> > if [[ ! -e $MAKEFILE ]];then

> > Read the ksh man page.

 
 
 

Korn Shell Srcipt Question

Post by abebebebebikil » Wed, 26 Jun 2002 19:04:32



> Hi

> I am wrote the following script in korn shell and its not working.

> export PLATFORM=ssunos5
> export ROOT=`pwd`
> export MAKEFILE=$ROOT/config/$PLATFORM/sample.mk

> if (! -e $MAKEFILE) then
>    echo ""
>    echo "ERROR: "
>    echo ""
> else
>    export INI=$ROOT/config/$PLATFORM/set.ini

>    echo "Platform: $PLATFORM"
>    echo "    Root: $ROOT"
>    echo "Makefile: $MAKEFILE"
>    echo "     INI: $INI"
>    echo ""
> fi

> =============

> when I run this script I get the following error

> ksh: -a:  not found

> I tried using -e also instead of -a that also didn't help any help on
> this will be highly appreciated.

> Sanjeev

BTW. hows those echo do print?
Can not similar lines to work
i.e: echo "hi ho $letsgo"
prints: hi ho
 
 
 

Korn Shell Srcipt Question

Post by Andreas K?h? » Thu, 27 Jun 2002 06:54:56


Submitted by "abebebebebikila" to comp.unix.shell:
[cut]

Quote:> BTW. hows those echo do print?
> Can not similar lines to work
> i.e: echo "hi ho $letsgo"
> prints: hi ho

You probably haven't set $letsgo to anything:

letsgo="let's go!"
echo "hi ho $letsgo"

--
Andreas K?h?ri
--------------------------------------------------------------
Stable, secure, clean, free:  www.netbsd.org