Quote
Username: veda
Password: *****
Password: *****
#! /bin/sh # bash interpreter. Tell the OS that it is bash interpreter
echo -n "Username: " # prompt it on the console; -n means no new line
read username # reads the input from the console and assign its to username
echo -n "Password: "
while [ 1 ]
do
read -s -n1 key # reads the input; -n 1 means read only one character at a time; -s means silent, it means don't display what is read
echo -n "*"
if [[ $key == "" ]]; # checks whether enter is pressed
then
exit 0 # exit with return value 0
fi
exit 0I guess the code is self explanatory...Now,How to run this code...
Once the program is ready,
Now change the permission of the program it command is
chmod u+x filename
Quote
chmod - change mode
u - user
x- executable
u+x - add executable permission to the user
filename - name of the file
u - user
x- executable
u+x - add executable permission to the user
filename - name of the file
./filename
Quote
. means current directory
./filename means execute the file in current directory
./filename means execute the file in current directory


Sign In
Create Account


Back to top









