rcmd.sh: fixed local variable for filename with help from Dean