Hello, first of all, I am a pretty experience c++ programmer, but have never really bothered learning bash scripting at all, so I know conceptually things that can be done in c++, but I'm not too sure about bash. I'm trying to learn Bash, and wanted to start out with a practical application. So I am trying to write a script that allows me to use the "login" command in the terminal and lets me enter the login user name, and the last 3 characters (which are digits) of a password. The password consists of 5 digits, and I want the script to test the login and password of all possible combinations for the first 2 digits, like using auto-increment or something. I'm not really too sure how to approach this, any help is commended.
function login
{
local USERNAME
local PASS
read -p "username: " USERNAME
read -p "last 3 digits of pass: " PASS
for COMBO in {0..9}{0..9}
do
echo "trying ${COMBO}${PASS}"
done
}
# You can now use the 'login' function like a command
$ login
username:
You may also like the advanced bash scripting guide.