-
Notifications
You must be signed in to change notification settings - Fork 1.9k
SC2278
Joachim Ansorg edited this page Nov 12, 2021
·
2 revisions
#!/bin/ksh
$0=myname
echo "Usage: $0 --help"#!/bin/ksh
myname() {
echo "Usage: $0 --help"
}
mynameYou appear to be trying to assign a new value to $0 in Ksh.
This is not possible. However, $0 will reflect the current function name, so if you wrap your code in a function with your chosen name, you can have $0 expand to it.
If you instead wanted to compare the value of $0, use a comparison like [ "$0" = "myname" ].
- Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!