Hi,
I'd like to access the script name ($0) in a shell function. I can do
this with
#!/opt/gnu/bin/bash
function myfunction {
set -- $0
echo "Parameters: $*"
echo "Count: $#"
return 0
}
myfunction test bla blub
Invoking the script returns
$ ./fct.sh a b c
Parameters: ./fct.sh
Count: 1
Removing the "set..." line returns
$ ./fct.sh a b c
Parameters: test bla blub
Count: 3
My questions are:
- Why gives the "set" statement as listed above access to the script
name?
- Why does this work with bash but not with ksh?
Thanks very much for your answer and please excuse the posting if this
isn't the right list.
Stephan