Don't understand $1 in shell scripts

Hi,
I can't work out how to use $1 in shell scripts.
If I have a script that (say) matches filename "foo.txt", I can trigger an embedded shell script
But if I try to use $1 in the script, like so:
then the logs show that the attempt just throws back a "usage" message for cp.
So what am I doing wrong?
(NB, this is a simplified example, I'm not really trying to use cp!)
I can't work out how to use $1 in shell scripts.
If I have a script that (say) matches filename "foo.txt", I can trigger an embedded shell script
- Code: Select all
cp foo.txt bar.txt
But if I try to use $1 in the script, like so:
- Code: Select all
cp $1 bar.txt
then the logs show that the attempt just throws back a "usage" message for cp.
So what am I doing wrong?
(NB, this is a simplified example, I'm not really trying to use cp!)