diff options
author | merakor <cem@ckyln.com> | 2020-04-20 17:57:37 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2020-04-20 17:57:37 +0000 |
commit | cd5705905d1e93e0e8397b3899d4336b51adf2f2 (patch) | |
tree | d679cc90e6ef31054152a2ab25787b612f7a0b02 | |
parent | 27e7d70cc297f06b9bd10b976333c4d0a1305e0f (diff) | |
download | cpt-cd5705905d1e93e0e8397b3899d4336b51adf2f2.tar.gz |
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
-rwxr-xr-x | kiss | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -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 |