-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1-passwordscript.sh
More file actions
38 lines (30 loc) · 878 Bytes
/
Copy path1-passwordscript.sh
File metadata and controls
38 lines (30 loc) · 878 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
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
############################
# Generate a bunch of hash #
############################
DataDir='./Data'
PasswordDate=$(date +%F-%T)
PasswordFile="$DataDir/PasswordFile-$PasswordDate"
mkdir -p "$DataDir"
touch "$PasswordFile"
while read line
do
var=$(openssl rand -base64 32 | sed 's/[^a-zA-Z0-9]//g' )
echo "export $line=$var" >> "$PasswordFile"
done < PasswordFile
read -p 'What is your ip' myip
echo "" >> "$PasswordFile"
echo "export MYIP=$myip" >> "$PasswordFile"
#echo "Do you want to save the PasswordFile (Y/y) "
#read answer
answer='y'
if [ "$answer" != "${answer#[Yy]}" ] ;then
cp "$PasswordFile" ~/keystonerc
echo "source ~/keystonerc " >> ~/.bash_profile
source ~/keystonerc
else
echo OK
fi
#sed 's/[A-Za-z][A-Za-z]*$/replace/' file.txt
#sed 's/[A-Za-z][A-Za-z]*$/replace/' file.txt
#ls -1 /etc/sysconfig/network-scripts/ifcfg-*