A few other thoughts.
Does the commands require root to run and you are using the script as a user?
So the script does run an completes, but does not do what it needed to do?
You might need to pause between the commands. This might be over kill but you might try this. Either use the sleep command or use the universal pause. I usually use this as a pause ' ping -c2 127.0.0.1 > /dev/null '. Also don't you need something like #!/bin/bash at the beginning of the script.
Code:
#!/bin/bash
smbclient '\\dir1\dir2' -U uname%passwd
sleep 2s
recurse
sleep 2s
prompt
sleep 2s
mput *
Code:
#!/bin/bash
smbclient '\\dir1\dir2' -U uname%passwd
ping -c2 127.0.0.1 > /dev/null
recurse
ping -c2 127.0.0.1 > /dev/null
prompt
ping -c2 127.0.0.1 > /dev/null
mput *
See if this helps.
Brian1