2 Replies Latest reply on Jan 10, 2019 5:34 AM by Mike Poole

    nsh if string contains....

    Mike Poole

      Not sure if I'm doing this right, but I'm trying to run a script which returns a list of patch exceptions for each server.


      The script works fine but I'm trying to condense the output. If I run this line:


                blcli_execute PatchingJob getExcludePatchListForDevice $server


      It lists ALL servers, and for some it shows the exceptions ( "[Q123456, Q456789]" for example) and for all others it returns "[No patches found for specified device.]"


      Therefore I just want to show ONLY the servers that actually have exceptions applied.


      My script looks like this currently, and it's the "If" line indicated below that I was wondering if ti was correct. I though i could just check to see if the returned value starts with "[Q" but I can't get it work. Is there  better way ?


      blcli_execute Server listAllServers 

      blcli_storeenv serverList


      for server in ${serverList} 



      blcli_execute PatchingJob getExcludePatchListForDevice $server

      blcli_storeenv result


      if [ "${result}" = "[Q*" ]               <--------------------------------------------------------


      echo ${server} ${result}