Hello.
From command line, the command zypper info nxclient
return a bloc of data :
linux local # zypper info nxclient
Loading repository data...
Reading installed packages...
Information for package nxclient:
Repository: zypper_local
Name: nxclient
Version: 3.5.0-7
Arch: x86_64
Vendor: NoMachine
Installed: No
Status: not installed
Installed Size: 10.3 MiB
Summary: NX Client
Description:
NoMachine NX is a fast and scalable terminal server system based on the
X11 protocol. NX lets you work fluently even across slow links like modems
and provides a full set of administration tools that make it a complete
desktop virtualization solution for your organization.
This package contains the graphical front-end used to access X, RDP and RFB
sessions on a remote NX Server. It also includes NX X compression libraries
and utilities needed by both NX Client and Server.
Baseline:
nx-X11: 3.5.0-1
nxauth: 3.5.0-1
nxwin: 3.5.0-2
nxssh: 3.5.0-2
nxcomp: 3.5.0-2
nxesd: 3.5.0-2
nxkill: 3.5.0-1
nxservice: 3.5.0-2
nxcompsh: 3.5.0-1
nx-X11-compat: 3.5.0-1
linux-srv:/local/install_from_local #
How to code a function which return true if the bloc of data contains some specific values.
something like :
#!/bin/bash
#
function my_filter() {
if Repository = zypper_local thenif Installed = No then
if Status = not installed then
my_filter = "TRUE"
fi
fi
fi
}
#MAIN
zypper info nxclient > file_temp.text
if my_filter(file_temp.txt) = true theninstall it
fi
# end
I look for a better solution that reading "file_temp.text" 3 times and looking for each parameter :
result=${ command | grep para1 para2 para3 )
if $result=true then
install
fi