Capturing Input Parameters on Shell Script

i have this basic line of code that doesn't work. i simply want to get the input parameter strings but when the script is run it appears that the first parameter is assigning the value to the second parameter.

#!/bin/sh

pdir=`pwd`
p1=$1
p2=$2

echo "directory: $pdir\n"
echo "parameter 1: $p1\n"
echo "parameter 2: $p2\n"
$ sh sample_file.sh /u02/app/ccalloc/dev/out/*.txt /export/home/ccalftdv
directory: /export/home/ccalftdv/apps

parameter 1: /u02/app/ccalloc/dev/out/EATVDAILY02132008.txt

parameter 2: /u02/app/ccalloc/dev/out/EATVDAILY02132008.txt

$ sh sample_file.sh /u02/app/ccalloc/dev/out/*.txt /export/home/ccalftdv
directory: /export/home/ccalftdv/apps

parameter 1: /u02/app/ccalloc/dev/out/EATVDAILY02132008.txt

parameter 2: /u02/app/ccalloc/dev/out/EATVDAILY03292007.txt

$

eventhough on the code it does not directly assign any to the second parameter.

i need to get the strings for each parameter e.g.:

$ sh sample_file.sh /u02/app/ccalloc/dev/out/*.txt /export/home/ccalftdv

parameter 1: /u02/app/ccalloc/dev/out/*.txt 

parameter 2: /export/home/ccalftdv

how do i do that? thanks.

Hi.

The shell is expanding /.../*.txt to all *.txt files and they become arguments to the script.

To stop that, you could use quotes around the argument that would otherwise be expanded:

sh sample_file.sh "/u02/app/ccalloc/dev/out/*.txt" /export/home/ccalftdv

thanks so much that works.