In a CentOS environment, running as root, invoking riak-shell -n <name> does not work. Adding -x to the script header shows that the -n and argument are dropped somewhere along the way because getopts just passes through. This probably applies to other arguments as well.
It is possible to work around this by specifying -d before the -n.
It is not clear yet what's happening. Could be a sudo or su invocation in the call path that's causing problems.