From bf28b3c49ddf6629067e7b33ef45a0a8caa3c046 Mon Sep 17 00:00:00 2001 From: typebrook Date: Fri, 31 Jan 2020 15:16:03 +0800 Subject: update --- scripts/gist | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/gist b/scripts/gist index 405b48a..182425c 100755 --- a/scripts/gist +++ b/scripts/gist @@ -92,7 +92,7 @@ _configure() { _ask_username() { while [[ ! $user =~ ^[[:alnum:]]+$ ]]; do - [[ ! -z $user ]] && echo "Not a valid username" + [[ -n $user ]] && echo "Not a valid username" read -p "Github username: " user < /dev/tty done _configure user $user @@ -106,7 +106,7 @@ _ask_token() { fi while [[ ! $token =~ ^[[:alnum:]]{40}$ ]]; do - [[ ! -z $token ]] && echo "Not a valid token" + [[ -n $token ]] && echo "Not a valid token" trap 'echo; return 1' INT read -p "Paste your token here (Ctrl-C to skip): " token < /dev/tty done @@ -282,7 +282,8 @@ _goto_gist() { if [[ ! -d $folder/$GIST_ID ]]; then echo 'Cloning gist as repo...' - if (git clone git@github.com:$GIST_ID.git $folder/$GIST_ID); then + git clone git@github.com:$GIST_ID.git $folder/$GIST_ID + if [[ "$?" -ne 0 ]]; then echo 'Repo is cloned' return 0 else -- cgit v1.2.3-70-g09d2