From 5216a4584c5de096ea2c69858df6db86850df900 Mon Sep 17 00:00:00 2001 From: Robby Dyer Date: Mon, 27 Jul 2015 07:58:43 -0400 Subject: [PATCH] Allow CLI arg for r/w/d --- pwd.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pwd.sh b/pwd.sh index a11c9fb..6ca90a8 100755 --- a/pwd.sh +++ b/pwd.sh @@ -160,8 +160,13 @@ sanity_check () { sanity_check -read -n 1 -p "Read, write, or delete password? (r/w/d, default: r) " action -printf "\n" +if [ -z ${1+x} ] +then + read -n 1 -p "Read, write, or delete password? (r/w/d, default: r) " action + printf "\n" +else + action="$1" +fi if [[ "${action}" =~ ^([wW])$ ]] ; then create_username && write_pass