spm

Personal fork of spm (simple password manager)

commit c4fddfba10946518b470d6dec1b8a9e78fbcbf98
parent 300bb4a96b856e0f3538a9b6aafbf367a4e353af
Author: nmeum <git-nmeum@8pit.net>
Date: Fri, 15 Nov 2013 16:04:10 +0100

Don't write to STDOUT when a pipe is connected to STDIN
1 file changed, 2 insertions(+), 2 deletions(-)
M
tpm
|
4
++--
diff --git a/tpm b/tpm
@@ -51,12 +51,12 @@ insert() {
     abort "USAGE: tpm insert [entry-name]"
   fi
 
-  if [ -e "${entry_path}" ]; then
+  if [ -e "${entry_path}" ] && [ -t 0 ]; then
     echo "This entry already exists it will be overwritten."
   fi
 
   IFS= read -p "Password for '${entry_name}': " -r -s password
-  echo
+  [ -t 0 ] && echo
 
   if [ -z "${password}" ]; then
     abort "You didn't specify a password."