How to call a bash script with positional parameters?

Hi,

I have a script which will be executed using the below command,

bin/nutch crawl urls -dir /data/test/

bin/nutch - Script file
crawl, urls, /data/test/ - Parameters
-dir - Option

The above script should executed from a shell script named test.sh. I have the below code to execute it, but it fails to pass the positional parameters,

# /bin/sh
path="/home/vel/vel-home/scripting/apache-nutch-1.6/bin"
. $path/nutch "crawl" -dir "$path/urls" "$path/data/test/"

Please help me to resolve this issue.

Change # /bin/sh => #!/bin/sh

#!/bin/sh
...

If you say "bash script", then why are you trying to use /bin/sh at the top of the script? For some reason, "sh" does not seem to work correctly with sourcing the file. "bash" works either way, sourcing or calling.

$ cat test1.sh
export path="/home/vel/vel-home/scripting/apache-nutch-1.6/bin"
. test2.sh $path
test2.sh $path
$ cat test2.sh
echo $1
$ ./test1.sh
/home/vel/vel-home/scripting/apache-nutch-1.6/bin
/home/vel/vel-home/scripting/apache-nutch-1.6/bin