Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

password with asterisk in bash script

#!/bin/bash

password=""
echo "Enter Username : "

# it will read username
read username
pass_var="Enter Password :"

# this will take password letter by letter
while IFS= read -p "$pass_var" -r -s -n 1 letter
do
    # if you press enter then the condition 
    # is true and it exit the loop
    if [[ $letter == $'' ]]
    then
        break
    fi
    
    # the letter will store in password variable
    password=password+"$letter"
    
    # in place of password the asterisk (*) 
    # will printed
    pass_var="*"
done
echo
echo "Your password is read with asterisk (*)."
Comment

PREVIOUS NEXT
Code Example
Shell :: docker error "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation. 
Shell :: how to find out specifics on m otherboard using linux mint 20.3 
Shell :: tapping homebrew/core 
Shell :: install psalm laravel 
Shell :: docker compose logs container stdout 
Shell :: check_mk ubuntu 20.04 
Shell :: regex log level info or warn or erro 
Shell :: increase filesystem space in aix 
Shell :: Grep check 
Shell :: uninstall maps 
Shell :: install Dirichlet Multinomial R package 
Shell :: c myprintf 
Shell :: copy too large file commmand linux 
Shell :: kali linux 2016 virtualbox password 
Shell :: python tree library 
Shell :: npm global install without sudo 
Shell :: linux tar.gz 
Shell :: bash how to create directories in all subdirectories 
Shell :: github pull request template 
Shell :: linux add user 
Shell :: gparted 
Shell :: rails run server 
Shell :: open terminal in current folder windows 
Shell :: linux date command live update 
Shell :: yay see package files 
Shell :: hue run command line arguments 
Shell :: calculate darkness value of an image 
Php :: php cors disable 
Php :: laravel order by random 
Php :: get session blade 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =