Last change
on this file since 4371 was
4371,
checked in by olle, 11 years ago
|
Refs #788. Unix/Linux *.sh shell scripts have the shebang line changed from "#!/bin/sh " to "#!/bin/bash ", in order to make the scripts work on Ubunto Linux without explicitly defining the shell.
|
-
Property svn:eol-style set to
native
-
Property svn:executable set to
*
-
Property svn:keywords set to
Id
|
File size:
746 bytes
|
Line | |
---|
1 | #!/bin/bash |
---|
2 | PS1="ProSE: " |
---|
3 | |
---|
4 | function help() |
---|
5 | { |
---|
6 | echo "passwd USER Change password of USER" |
---|
7 | } |
---|
8 | |
---|
9 | function hide() |
---|
10 | { |
---|
11 | stty -echo |
---|
12 | } |
---|
13 | |
---|
14 | function unhide() |
---|
15 | { |
---|
16 | stty echo |
---|
17 | } |
---|
18 | |
---|
19 | function passwd() |
---|
20 | { |
---|
21 | uid=`mysql -b proteios -e "select id from Users where login='$1'"|sed s/id//g` |
---|
22 | if [ -z $uid ] || [ "$uid" == "" ]; then |
---|
23 | echo "No such user $1" >> /dev/stderr |
---|
24 | else |
---|
25 | hide |
---|
26 | read -p "New $1 password: " p1; echo |
---|
27 | read -p "Repeat $1 password: " p2; echo |
---|
28 | unhide |
---|
29 | echo |
---|
30 | if [ "$p1" == "$p2" ]; then |
---|
31 | md5=`echo -n $p1 | md5sum | awk '{print $1}'` |
---|
32 | mysql -b proteios -e "update Passwords set md5password='$md5' where id = $uid" |
---|
33 | echo "$1 password changed" |
---|
34 | else |
---|
35 | echo "Failed: passwords do not match" |
---|
36 | fi |
---|
37 | fi |
---|
38 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.