apt list prints an extra field "[installed]" when a package is installed. however when package is not installed it omits the "[installed]\n" field from the record. how do a write this code to check if "[installed]\n" is the last field or not and if so return true, else return false.
the actual print out is:
if installed:
Listing...
sysfsutils/bionic,bionic-updates 2.1.0+repack-4build1 amd64 [installed]
if not installed:
Listing...
sysfsutils/bionic,bionic-updates 2.1.0+repack-4build1 amd64
> the actual print out is:
¿why there is no "cmd = ", "apt_list = ", or any other logging?
¿what's the problem with your code? ¿does it crash? ¿the result is wrong? ¿pure garbage?
> I tried to cut "Listing...\n" with erase()
use a debugger to see the actual content of your variables.
perhaps "Listing..." is produced by your command and send to the error stream
also, you may check if your strings do end with a '\n'
> bool isInstalled = (token==installed)?true:false;
may be simplified to bool isInstalled = token==installed;