some cleanup
authorzapata <zapata>
Sat, 7 Feb 2004 11:50:13 +0000 (11:50 +0000)
committerzapata <zapata>
Sat, 7 Feb 2004 11:50:13 +0000 (11:50 +0000)
dbscripts/extra/hashpasswords.sh

index 258bf61..a4629d0 100755 (executable)
@@ -19,24 +19,24 @@ if [ $# -ne 1 ]; then
 fi;
 
 
-# to get a backslash in the first pass sql script\r
-s1="\\"\r
-# to get a backslash in the second pass sql script\r
-s2="\\\\"\r
-# to get an escaped backslash in the second pass sql script:\r
-s3="\\\\\\\\"\r
+# to get a backslash in the first pass sql script
+s1="\\"
+# to get a backslash in the second pass sql script
+s2="\\\\"
+# to get an escaped backslash in the second pass sql script:
+s3="\\\\\\\\"
 
  
 SCRIPT_FILE="/tmp/hashpasswords.$$.sql"
 
-echo psql $1 -P format=unaligned -t -X -F "" -c \
-  "select '${s2}set hashedpassword ${s1}'${s2}${s1}'${s1}' \`echo -n \"'||password||'\" | md5sum \`   \\r
-            \"${TEXT_SOURCE_PATH}\$(basename \"' || trim($2) || '\")\"\` ${s1}'${s2}${s1}'\\'\n',  \\r
-                'update webdb_users set password=:hashedpassword where id = '||id from webdb_users" > $SCRIPT_FILE\r
+psql $1 -P format=unaligned -t -X -F "" -c \
+  "select '${s2}set hashedpassword ${s1}'${s2}${s1}'${s1}' \`echo -n \"'||password||'\" | md5sum \`   \
+            \"${TEXT_SOURCE_PATH}\$(basename \"' || trim($2) || '\")\"\` ${s1}'${s2}${s1}'\\'\n',  \
+                'update webdb_users set password=:hashedpassword where id = '||id from webdb_users" > $SCRIPT_FILE
 
 
 # execute the script
 #psql -f ${SCRIPT_FILE} -d template1
-cat SCRIPT_FILE
+cat $SCRIPT_FILE
 
 rm ${SCRIPT_FILE}