-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample01.sh
More file actions
26 lines (20 loc) · 700 Bytes
/
example01.sh
File metadata and controls
26 lines (20 loc) · 700 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
# Display what the user types on the command line.
echo "You executed the command : ${0}"
# Display the path and filename of the script.
echo "You used $(dirname ${0}) as the path to the $(basename ${0}) script"
# Tell them how many arguments they passed in.
NUMBER_OF_PARAMETERS="${#}"
echo "You supplied ${NUMBER_OF_PARAMETERS} argument(s) on the command line."
# Make sure they at leasat supply one argument.
if [[ "${NUMBER_OF_PARAMETERS}" -lt 1 ]]
then
echo "Usage: ${0} USER_NAME [USER_NAME]..."
exit 1
fi
# Generate and display a password for each parameter
for USER_NAME in "${@}"
do
PASSWORD=$(date +%s%N |sha256sum | head -c12)
echo "${USER_NAME}: ${PASSWORD}"
done