bash
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
bash [2023/01/17 14:24] – roger | bash [2024/11/17 12:59] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 13: | Line 13: | ||
* '' | * '' | ||
* '' | * '' | ||
+ | |||
+ | More info: https:// | ||
+ | |||
+ | ===== Read passwords with feedback on a script ===== | ||
+ | |||
+ | <code bash> | ||
+ | unset password | ||
+ | charcount=0 | ||
+ | prompt=" | ||
+ | while IFS= read -p " | ||
+ | do | ||
+ | if [[ $char == $' | ||
+ | then | ||
+ | break | ||
+ | fi | ||
+ | if [[ $char == $' | ||
+ | if [ $charcount -gt 0 ] ; then | ||
+ | charcount=$((charcount-1)) | ||
+ | prompt=$' | ||
+ | password=" | ||
+ | else | ||
+ | prompt='' | ||
+ | fi | ||
+ | else | ||
+ | charcount=$((charcount+1)) | ||
+ | prompt=' | ||
+ | password+=" | ||
+ | fi | ||
+ | done | ||
+ | </ |
bash.1673965462.txt.gz · Last modified: 2024/11/17 12:59 (external edit)