Skip to main content
! -z == -n
Source Link
athena
  • 1.1k
  • 7
  • 24

I would suggest to use very basic builtin functions of the shell:

ck_command() { [ ! -zn $("$@") ] ; }

Here is the simplest test case:

ck_command echo 1 ; echo $?

ck_command echo ; echo $?

Then you could easily use it with the || construct you are used to:

ck_command command_1 || ck_command command_2

This simple function will work as you would like with your apt_cache behaviour whichever the number of arguments would be.

I would suggest to use very basic builtin functions of the shell:

ck_command() { [ ! -z $("$@") ] ; }

Here is the simplest test case:

ck_command echo 1 ; echo $?

ck_command echo ; echo $?

Then you could easily use it with the || construct you are used to:

ck_command command_1 || ck_command command_2

This simple function will work as you would like with your apt_cache behaviour whichever the number of arguments would be.

I would suggest to use very basic builtin functions of the shell:

ck_command() { [ -n $("$@") ] ; }

Here is the simplest test case:

ck_command echo 1 ; echo $?

ck_command echo ; echo $?

Then you could easily use it with the || construct you are used to:

ck_command command_1 || ck_command command_2

This simple function will work as you would like with your apt_cache behaviour whichever the number of arguments would be.

Source Link
athena
  • 1.1k
  • 7
  • 24

I would suggest to use very basic builtin functions of the shell:

ck_command() { [ ! -z $("$@") ] ; }

Here is the simplest test case:

ck_command echo 1 ; echo $?

ck_command echo ; echo $?

Then you could easily use it with the || construct you are used to:

ck_command command_1 || ck_command command_2

This simple function will work as you would like with your apt_cache behaviour whichever the number of arguments would be.