I will give you an example with sshpass using a temporary fd that will be closed later, also to use the password as an argument instead of stdin wit using set -x it won't printed out the password :
#Set the password as an environment variable
export password=MyPassword
#Create the file descriptor 3 and link it to /tmp/pwd, you can use one from 3 to 9.
exec 3<> /tmp/pwd
#Copy the content of password env variable to /tmp/pwd using dd command
dd of=/tmp/pwd <<< "$password"
#Here using cat and passing it to xargs so stdout will be catched by stdin of xargs, then the password will be available within the second curly brackets
cat /tmp/pwd|pwd | xargs -I {} sshpass -p {} ssh <user>@<ip>
#Close the file descriptor
exec 3>&-
#Remove the tmp file
rm -f /tmp/pwd
You can adjust this answer to your use cases.