about summary refs log tree commit diff stats
path: root/bin/pw
diff options
context:
space:
mode:
Diffstat (limited to 'bin/pw')
-rwxr-xr-xbin/pw25
1 files changed, 2 insertions, 23 deletions
diff --git a/bin/pw b/bin/pw
index cec9e54..fa33761 100755
--- a/bin/pw
+++ b/bin/pw
@@ -1,25 +1,4 @@
 #!/bin/sh
-# generates a password of length $1, sends it to stdout if $2 is blank.
-# if $2 is clip, sends it to the X clipboard and clears it after 10 seconds.
-# if $2 is anything else, sends it to the X primary selection and clears it after 10 seconds
-if [ "$1" = "-h" ]; then
-  printf 'usage: %s [-h]|LENGTH [clip|pri]\n' "$(basename $0)">/dev/stderr
-  return 1
-fi
+# generates a password of length $1.
 PW=$(tr -cd "[:alnum:][:punct:]"</dev/urandom|fold -w "$1"|head -1)
-if [ -n "$2" ]; then
-    # streamline selection variation by using $SEL
-    if [ "$2" = "clip" ]; then
-	    SEL="-sel clip"
-    else
-	    SEL=""
-    fi
-    # backgrounds so the user doesn't have to wait 10 seconds to get a prompt again
-      {
-      printf "%s" "$PW"|xclip $SEL -i&&notify-send "Password Generated" "$1-character password generated. It will clear in 10 seconds."
-      sleep 10
-      printf '\0'|xclip $SEL -i&&notify-send "Clipboard Cleared" "Generated password cleared from clipboard."
-      } &
-else
-  printf '%s\n' "$PW"
-fi
+printf '%s\n' "$PW"