How to encode the rdesktop password parameter in a shell script?

I would recommend that you store the password in a file and pass it to rdesktop through a pipe. That way, the password won't show up as an argument in the command line when running ps or similar.

cat secretfile | /usr/bin/rdesktop -N -x m -u Administrator -p - -d ...

To answer your question, however, simply quoting the argument may be enough to make it work:

/usr/bin/rdesktop -N -x m -u Administrator -p '#secret$123#' -d ...

Edit:

To use a variable (the value will be visible in output from ps):

var='#secret$123#'
/usr/bin/rdesktop -N -x m -u Administrator -p "$var" -d ...

or

var=$(<secretfile)    # read from a file (doesn't work in sh)
/usr/bin/rdesktop -N -x m -u Administrator -p "$var" -d ...

Special characters need to be escaped with a '\' in the Linux command line.

You can post your password and I'll show you how it should look. ;) Kidding... of course.