[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

shell script

Vandana

9/15/2008 2:36:00 PM

Hi All,

I have a shell script which I use to call a ruby program. I pass
parameters from the shell script to the ruby program

Example:

#!/bin/csh -f

set DEST_DIR=/home/vandana/
ruby test.rb -p $DEST_DIR


----------------------------------

When I execute the above, I get the error "Cannot convert nil to
String. I know that $DEST_DIR is not empty because when I do an echo
$DEST_DIR I see the /home/vandana/

What am I missing here?

----------------------------------------
If I put the command "ruby test.rb -p $DEST_DIR" in quotes I get the
message command not found.


Please help!
Thanks,

4 Answers

Googy

9/15/2008 2:39:00 PM

0

On Sep 15, 7:36 pm, Vandana <nair...@gmail.com> wrote:
> Hi All,
>
> I have a shell script which I use to call a ruby program. I pass
> parameters from the shell script to the ruby program
>
> Example:
>
> #!/bin/csh -f
>
> set DEST_DIR=/home/vandana/
> ruby test.rb -p $DEST_DIR
>
> ----------------------------------
>
> When I execute the above, I get the error "Cannot convert nil to
> String. I know that $DEST_DIR is not empty because when I do an echo
> $DEST_DIR I see the /home/vandana/
>
> What am I missing here?
>
> ----------------------------------------
> If I put the command "ruby test.rb -p $DEST_DIR" in quotes I get the
> message command not found.
>
> Please help!
> Thanks,

try this

ruby test.rb -p `echo $DEST_DIR`

Googy

9/15/2008 2:44:00 PM

0

On Sep 15, 7:39 pm, samba <cooldudevam...@gmail.com> wrote:
> On Sep 15, 7:36 pm, Vandana <nair...@gmail.com> wrote:
>
>
>
> > Hi All,
>
> > I have a shell script which I use to call a ruby program. I pass
> > parameters from the shell script to the ruby program
>
> > Example:
>
> > #!/bin/csh -f
>
> > set DEST_DIR=/home/vandana/
> > ruby test.rb -p $DEST_DIR
>
> > ----------------------------------
>
> > When I execute the above, I get the error "Cannot convert nil to
> > String. I know that $DEST_DIR is not empty because when I do an echo
> > $DEST_DIR I see the /home/vandana/
>
> > What am I missing here?
>
> > ----------------------------------------
> > If I put the command "ruby test.rb -p $DEST_DIR" in quotes I get the
> > message command not found.
>
> > Please help!
> > Thanks,
>
> try this
>
> ruby test.rb -p `echo $DEST_DIR`
use

ruby test.rb -p `echo DEST_DIR`

Vandana

9/15/2008 2:48:00 PM

0

Thanks samba.
I exited from the shell and re logged in..now it works even without
the echo...strange

Thanks a lot.

On Sep 15, 10:43 am, samba <cooldudevam...@gmail.com> wrote:
> On Sep 15, 7:39 pm, samba <cooldudevam...@gmail.com> wrote:
>
> > On Sep 15, 7:36 pm, Vandana <nair...@gmail.com> wrote:
>
> > > Hi All,
>
> > > I have a shell script which I use to call a ruby program. I pass
> > > parameters from the shell script to the ruby program
>
> > > Example:
>
> > > #!/bin/csh -f
>
> > > set DEST_DIR=/home/vandana/
> > > ruby test.rb -p $DEST_DIR
>
> > > ----------------------------------
>
> > > When I execute the above, I get the error "Cannot convert nil to
> > > String. I know that $DEST_DIR is not empty because when I do an echo
> > > $DEST_DIR I see the /home/vandana/
>
> > > What am I missing here?
>
> > > ----------------------------------------
> > > If I put the command "ruby test.rb -p $DEST_DIR" in quotes I get the
> > > message command not found.
>
> > > Please help!
> > > Thanks,
>
> > try this
>
> > ruby test.rb -p `echo $DEST_DIR`
>
> use
>
> ruby test.rb -p `echo DEST_DIR`

Nobuyoshi Nakada

9/15/2008 3:57:00 PM

0

Vandana wrote in [ruby-talk:314963]:
At Mon, 15 Sep 2008 23:32:48 +0900,
> If I put the command "ruby test.rb -p $DEST_DIR" in quotes I get the
> message command not found.

It's strange.
Don't you have another "ruby" command written in shell script?

--
Nobu Nakada