Perhaps have the shell script ask for the key, then store the key in a temp file and use openssl's -kfile option to find it. Hope your version of openssl supports -kfile.
I'd worry about security with this, but with a little care the security hole is perhaps smaller than you might think. (But do you trust your sysadmin and sudoers...?)
#!/bin/bash
INFILE=somefile
read -s -p "Enter key for $INFILE: " key
echo
# write the key to a temp file; use mktemp(1)
# for safer creation of a privately-owned file.
#
TMPKEY=$(mktemp -t) || exit 1
echo "$key" > "$TMPKEY"
# will remove the temp file on script exit
trap 'rm -f "$TMPKEY"' EXIT
# remove the key file a couple seconds after openssl runs
(sleep 2; rm -f "$TMPKEY") &
openssl enc -d -aes256 -in "$INFILE" -kfile "$TMPKEY" | less
[ -f "$TMPKEY" ] && rm -f "$TMPKEY"
trap - EXIT
# rest of script...
exit 0