[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Why does this work
From: |
Stephan Austermühle |
Subject: |
Why does this work |
Date: |
Wed, 30 Jan 2002 11:57:51 +0100 |
User-agent: |
Mutt/1.2.5i |
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
- Why does this work,
Stephan Austermühle <=