From cd5705905d1e93e0e8397b3899d4336b51adf2f2 Mon Sep 17 00:00:00 2001 From: merakor Date: Mon, 20 Apr 2020 17:57:37 +0000 Subject: kiss: check for the first argument Instead of 'intense' shell arithmethic, we could just check if the first argument is available. This is much more easier to read and understand. It doesn't affect the speed of execution either. FossilOrigin-Name: 094587846e53fd489217584615fe392b9245876227723b8b63fd3cb969becb7b --- kiss | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kiss b/kiss index 10e844d..11848a6 100755 --- a/kiss +++ b/kiss @@ -1223,9 +1223,8 @@ args() { # the arguments that follow are all package names. action=$1 - # 'dash' exits on error here if 'shift' is used and there are zero - # arguments despite trapping the error ('|| :'). - shift "$(($# > 0 ? 1 : 0))" + # 'dash' gives an error when shift is used without any arguments. + [ "$1" ] && shift # Unless this is a search, sanitize the user's input. The call to # 'pkg_find()' supports basic globbing, ensure input doesn't expand -- cgit v1.2.3