In Powershell if I want to hide the password in a script, I run this command:
Read-Host -assecurestring | convertfrom-securestring | Out-File C:\tmp\password.txt

I get a popup, enter my password and the text file is created containing a very long string of characters. If I need to use the password in a script I use this:
Get-Content C:\tmp\password.txt | ConvertTo-SecureString

This is convenient because I don't get password prompts when running scripts.

How can I do this on Linux, in a bash script?