From e6b0c972b063ccc3910aa4166bfe97cd8e9673ac Mon Sep 17 00:00:00 2001 From: Liz Rea Date: Tue, 7 Jul 2015 13:06:36 +1200 Subject: [PATCH] Bug 13143 - Detect if the password is in a pipe 1. cd kohaclone/debian/scripts 2. sudo koha-passwd instance | cat Output should be password only 3. sudo koha-passwd instance Output should be "Password for $instance is: $password" Does this get at what you were wanting, Robin? --- debian/scripts/koha-passwd | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/debian/scripts/koha-passwd b/debian/scripts/koha-passwd index b9faa02..5be04b4 100755 --- a/debian/scripts/koha-passwd +++ b/debian/scripts/koha-passwd @@ -45,11 +45,15 @@ EOF for name in "$@" do if is_instance $name ; then - passwd=$(xmlstarlet sel -t -v 'yazgfs/config/pass' /etc/koha/sites/$name/koha-conf.xml); - echo "Password for $name: $passwd" - echo "Press enter to clear the screen..." - read anykey - clear + passwd=$(xmlstarlet sel -t -v 'yazgfs/config/pass' /etc/koha/sites/$name/koha-conf.xml); + if [ -t 1 ]; then + echo "Password for $name: $passwd" + echo "Press enter to clear the screen..." + read anykey + clear + else + echo "$passwd" + fi else warn "Unknown instance $name." fi -- 1.9.1