-
-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shell Exercise 03 - Random Password Generator #364
Comments
with javascript or what? |
Hi @alirafatartist, with shell script please. Thank you |
i think you wanted it with javascript but this is Chatgpt answer #!/bin/bash
generate_password() {
local length=$1
local password=""
for i in $(seq 1 $length); do
# Generate a random byte and convert it to a printable ASCII character
byte=$(od -An -N1 -i /dev/urandom | awk '{print $1}')
char=$(echo $byte | awk '{printf "%c", $1}')
password="${password}${char}"
done
echo "$password"
}
# Check if a length argument is provided
if [ -z "$1" ]; then
echo "Usage: $0 <password_length>"
exit 1
fi
# Get the password length from command line argument
password_length=$1
# Generate and print the random password
random_password=$(generate_password "$password_length")
echo "Random Password: $random_password" |
Thanks @alirafatartist this is for shell script initially - to help everyone on shell script practice, could you please open a Pull request to address this task? |
Do you mean make file with this code and make pull request to this repo |
Yes, that's right. And if you want to contribute to this repo 😍 |
in any folder or what?? |
Under folder https://github.com/tungbq/devops-basic/tree/main/topics/shell/excercise/answers |
check it ! |
This task is still not resolved, welcome other contributors |
This issue is stale because it has been open for 30 days with no activity. |
Hi @tungbq Can I tackle this? |
Thank you @Jonathanlemon I've just assigned it to you. |
Random Password Generator: Create a script that generates a random password of a specified length.
Similar to #361 #363
DoD:
The text was updated successfully, but these errors were encountered: