# Shell script

**URL:** <https://www.ruby-forum.com/t/shell-script/148616>\
**Category:** Ruby\
**Created:** [September 15, 2008, 4:41pm UTC](https://www.ruby-forum.com/t/shell-script/148616 "2008-09-15T16:41:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vandana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/aeb1de/32.png) [@Vandana](https://www.ruby-forum.com/u/Vandana)\
**Post date:** [September 15, 2008, 4:41pm UTC](https://www.ruby-forum.com/t/shell-script/148616/1 "2008-09-15T16:41:14Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![Vandana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/aeb1de/32.png) [@Vandana](https://www.ruby-forum.com/u/Vandana)\
**Post date:** [September 15, 2008, 4:44pm UTC](https://www.ruby-forum.com/t/shell-script/148616/2 "2008-09-15T16:44:46Z")

</div>

On Sep 15, 7:36 pm, Vandana [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ruby test.rb -p $DEST\_DIR  
> 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`

---

<div class="post-metadata">

**Author:** ![Vandana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/aeb1de/32.png) [@Vandana](https://www.ruby-forum.com/u/Vandana)\
**Post date:** [September 15, 2008, 4:45pm UTC](https://www.ruby-forum.com/t/shell-script/148616/3 "2008-09-15T16:45:57Z")

</div>

On Sep 15, 7:39 pm, samba [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ruby test.rb -p `echo $DEST_DIR`  
> use

ruby test.rb -p `echo DEST_DIR`

---

<div class="post-metadata">

**Author:** ![Vandana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/aeb1de/32.png) [@Vandana](https://www.ruby-forum.com/u/Vandana)\
**Post date:** [September 15, 2008, 4:50pm UTC](https://www.ruby-forum.com/t/shell-script/148616/4 "2008-09-15T16:50:41Z")

</div>

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

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![Vandana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/aeb1de/32.png) [@Vandana](https://www.ruby-forum.com/u/Vandana)\
**Post date:** [September 15, 2008, 6:41pm UTC](https://www.ruby-forum.com/t/shell-script/148616/5 "2008-09-15T18:41:32Z")

</div>

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?
