Issue with Automator and bash script
bash does expansion of $@ different than all other environment variables to preserve white space etc in arguments. From bash(1):

@ Expands  to  the  positional  parameters,  starting from one.  When the expansion occurs
  within double quotes, each parameter expands to a  separate  word.   That  is,  "$@"  is
  equivalent  to  "$1"  "$2" ...  If the double-quoted expansion occurs within a word, the
  expansion of the first parameter is joined with the beginning part of the original word,
  and  the  expansion  of  the last parameter is joined with the last part of the original
  word.  When there are no positional parameters, "$@" and $@  expand  to  nothing  (i.e.,
  they are removed).


So you basically should be able to call rar within the Shell Script action without any parsing:

/usr/local/bin/rar a ~/archive.rar "$@"