<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Function List incomplete]]></title><description><![CDATA[<p dir="auto">Greetings. I recently noticed that the Function List for some of my Shell-formatted scripts is incomplete. I write my scripts using a fairly consistent format when it comes to my functions. For some reason, this function refuses to show up in the list even after saving, closing NPP and restarting. I have several other functions that all show up in the list. I didn’t find any previous posts that were related to Shell-formatted functions, and I didn’t see anything in the bash.xml function list template that looked like it might cause it to be excluded. Any help is appreciated. Debug info included below the function code.</p>
<p dir="auto">Thanks!</p>
<pre><code>fix_install()
{
print_msg "(${MM}/${DD} $(date +%R)) Started fix_install" "debug"

unset FIXFILE FIXRPMSBASE FIXRPMSFP FIXSVR MQFIXCMD MQFIXCMDOUT

local FIXFILE="${MQINSTBASE}${MQVERSION}.tar.gz"
local FIXRPMSBASE="$( echo -e "${_MQRPMS}" | grep -ivE "(BES|${MQVERBASEERE}[^0])" | tr -s '\n' ' ' )"
local FIXRPMSFP="$( echo -e "${_MQRPMS}" | grep -ivE "(BES|${MQVERBASEERE}0)" | tr -s '\n' ' ' )"
local FIXSVR="${1}"
local MQFIXCMD=""
local let MQFIXCMDOUT=99

MQFIXCMD="${RPMINST} --force ${FIXRPMSFP} 2&gt;&amp;1 ; echo -e \"RESULT=\$?\""
print_msg "FIXFILE=${FIXFILE}~n\nFIXRPMSBASE=${FIXRPMSBASE}~n\nFIXRPMSFP=${FIXRPMSFP}\
~nFIXSVR=${FIXSVR}~n\nMQFIXCMD=${MQFIXCMD}~nMQFIXCOUNT=${MQFIXCOUNT}" "debug"

if (( DRYRUN ))
  then
    print_msg "copy_files ${FIXSVR} ${SOURCESVR} \"${(e)SOURCEDIR}${PATCHVER}\" \"${FIXFILE}\"" "dryrun"
    print_msg "MQFIXCMDOUT=\"\$( nexec -i -l \${FIXSVR} \"\${MQFIXCMD}\" )\"" "dryrun"
  else
    copy_files ${FIXSVR} ${SOURCESVR} "${(e)SOURCEDIR}${PATCHVER}" "${FIXFILE}"
    MQFIXCMDOUT="$( nexec -i -l ${FIXSVR} "${MQFIXCMD}" )"
    if &lsqb;&lsqb; $( echo -e "${MQFIXCMDOUT}" | grep -i "RESULT=" | cut -f2 -d'=' ) != 0 &rsqb;&rsqb;
      then
        ERRORDESC="ERROR 12 : Errors detected after fixing install on ${FIXSVR}"
        let ERROR_CODE=12
        critical_error
    fi
fi

print_msg "(${MM}/${DD} $(date +%R)) End fix_install" "debug"
}
</code></pre>
<p dir="auto"><strong>Debug Info</strong><br />
Notepad++ v8.5.3   (64-bit)<br />
Build time : May 15 2023 - 06:09:36<br />
Path : C:\Program Files\Notepad++\notepad++.exe<br />
Command Line :<br />
Admin mode : OFF<br />
Local Conf mode : OFF<br />
Cloud Config : OFF<br />
OS Name : Windows 10 Enterprise (64-bit)<br />
OS Version : 22H2<br />
OS Build : 19045.2965<br />
Current ANSI codepage : 1252<br />
Plugins :<br />
BetterMultiSelection (1.5)<br />
BigFiles (0.1.3)<br />
CodeAlignmentNpp (14.1.107)<br />
Comment Wrap (1.0.0.5)<br />
ComparePlugin (2.0.2)<br />
ComparePlus (1.1)<br />
DSpellCheck (1.5)<br />
GitSCM (1.4.8.2)<br />
HTMLTag (1.3.7)<br />
JSMinNPP (1.2205)<br />
JsonTools (4.14)<br />
Linter (0.1)<br />
mimeTools (2.9)<br />
nppConverter (4.5)<br />
nppcrypt (1.0.1.6)<br />
NppExport (0.4)<br />
NppGist (1.5.1.35)<br />
NPPJSONViewer (2.0.5)<br />
nppplugin_svn (3.0.1)<br />
NppQrCode64 (0.0.0.1)<br />
NppSaveAsAdmin (1.0.211)<br />
NppSnippets (1.7.1)<br />
NppToolBucket (1.10.6622.41516)<br />
NppXmlTreeviewPlugin (2)<br />
Python Indent (1.0.0.4)<br />
PythonScript (2)<br />
RegexTrainer (1)<br />
Remove Duplicate Lines (1.3)<br />
RestApiToText (1.4.0.1)<br />
SelectToClipboard (1.0.3)<br />
SQLinFormNpp64 (6.23.3.24)<br />
urlPlugin (1.2)<br />
XMLTools (3.1.1.13)<br />
_CustomizeToolbar (5.3)</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/24540/function-list-incomplete</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Jul 2026 13:09:54 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/24540.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 05 Jun 2023 22:03:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Function List incomplete on Tue, 13 Jun 2023 22:01:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/greg-michael" aria-label="Profile: greg-michael">@<bdi>greg-michael</bdi></a> Yes</p>
]]></description><link>https://community.notepad-plus-plus.org/post/87062</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/87062</guid><dc:creator><![CDATA[MAPJe71]]></dc:creator><pubDate>Tue, 13 Jun 2023 22:01:39 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Tue, 13 Jun 2023 18:00:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mapje71" aria-label="Profile: MAPJe71">@<bdi>MAPJe71</bdi></a> said in <a href="/post/87029">Function List incomplete</a>:</p>
<blockquote>
<p dir="auto">for the parser (presuming <code>...</code> does not contain double quotes):<br />
<code>string_literal_name=" ... \" ... \" ... "</code><br />
<code>string_literal_name="${ ... \" ... \" ... }"</code><br />
and those strings within a string within a string:<br />
<code>string_literal_name="${ ... \" ... \\\" ... \\\"  ... \" ... }"</code></p>
<blockquote>
<p dir="auto">commands being executed within a sub shell call, and the results being returned and stored as a String</p>
</blockquote>
<p dir="auto"><code>string_literal_name=${ ... }</code></p>
<p dir="auto">The parser will see at least two string literals in the following line:<br />
<code>string_literal_name="${ part1 " part2 " part3 }"</code><br />
i.e. <code>"${ part1 "</code> and <code>" part3 }"</code></p>
</blockquote>
<p dir="auto">Is it safe to assume that your use of the curly braces in lieu of the parentheses is accidental?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/87052</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/87052</guid><dc:creator><![CDATA[greg-michael]]></dc:creator><pubDate>Tue, 13 Jun 2023 18:00:04 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Mon, 12 Jun 2023 19:41:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/greg-michael" aria-label="Profile: greg-michael">@<bdi>greg-michael</bdi></a></p>
<blockquote>
<p dir="auto">those strings within a string</p>
</blockquote>
<p dir="auto">for the parser (presuming <code>...</code> does not contain double quotes):<br />
<code>string_literal_name=" ... \" ... \" ... "</code><br />
<code>string_literal_name="${ ... \" ... \" ... }"</code><br />
and those strings within a string within a string:<br />
<code>string_literal_name="${ ... \" ... \\\" ... \\\"  ... \" ... }"</code></p>
<blockquote>
<p dir="auto">commands being executed within a sub shell call, and the results being returned and stored as a String</p>
</blockquote>
<p dir="auto"><code>string_literal_name=${ ... }</code></p>
<p dir="auto">The parser will see at least two string literals in the following line:<br />
<code>string_literal_name="${ part1 " part2 " part3 }"</code><br />
i.e. <code>"${ part1 "</code> and <code>" part3 }"</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/87029</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/87029</guid><dc:creator><![CDATA[MAPJe71]]></dc:creator><pubDate>Mon, 12 Jun 2023 19:41:20 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Mon, 12 Jun 2023 16:05:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mapje71" aria-label="Profile: MAPJe71">@<bdi>MAPJe71</bdi></a> said in <a href="/post/86975">Function List incomplete</a>:</p>
<blockquote>
<p dir="auto">For instance double quoted string literals start and end with a double quote and any double quote within <em>must</em> be escaped.</p>
</blockquote>
<p dir="auto">This is true, except when using a subshell call : $( … ). The double quotes within the subshell execution are treated separately from the string literal definition. At least that’s the way I’ve learned to use them in Shell scripting.</p>
<blockquote>
<p dir="auto">AFAICT a lot of the double quoted string definitions in the provided source contain un-escaped double quotes.</p>
</blockquote>
<p dir="auto">For those strings within a string, yes, they are escaped. For those commands being executed within a subshell call, and the results being returned and stored as a String, no.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/87019</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/87019</guid><dc:creator><![CDATA[greg-michael]]></dc:creator><pubDate>Mon, 12 Jun 2023 16:05:32 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Sat, 10 Jun 2023 21:45:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/greg-michael" aria-label="Profile: greg-michael">@<bdi>greg-michael</bdi></a></p>
<p dir="auto">Any part of the source that matches the <code>commentExpr</code> of the parser is skipped during the search for class, method and function definitions.<br />
For the majority of the available parsers this feature is used to prevent detection of function definitions in text definitions (aka string literals). The detection of string literals highly depends on the proper i.e. quote balanced text definitions. Any improper definition can lead to all kinds of unexpected results.</p>
<p dir="auto">For instance double quoted string literals start and end with a double quote and any double quote within <em>must</em> be escaped.</p>
<p dir="auto">AFAICT a lot of the double quoted string definitions in the provided source contain un-escaped double quotes.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/86975</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/86975</guid><dc:creator><![CDATA[MAPJe71]]></dc:creator><pubDate>Sat, 10 Jun 2023 21:45:24 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Fri, 09 Jun 2023 23:53:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a> said in <a href="/post/86956">Function List incomplete</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/greg-michael" aria-label="Profile: greg-michael">@<bdi>greg-michael</bdi></a></p>
<p dir="auto">I think something went wrong with the cut and pastes, from line 403 on it lexes as a string:</p>
</blockquote>
<p dir="auto">I went back and copied that section of pasted code separately from the forum post into a new Shell-formatted document in NP++ and it looked normal. Did you possibly miss a starting quote in the copy/paste from the forum into your NP++?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/86966</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/86966</guid><dc:creator><![CDATA[greg-michael]]></dc:creator><pubDate>Fri, 09 Jun 2023 23:53:30 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Sat, 10 Jun 2023 00:18:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mapje71" aria-label="Profile: MAPJe71">@<bdi>MAPJe71</bdi></a> Interesting… I have a few other lines throughout the script that utilize the same syntax structure I believe. Why wouldn’t those functions be affected the same way? For example, lines #370-#375, lines #814-#815, lines #1271-#1272, line #1321, line #1333, and lines #1384-#1385.</p>
<p dir="auto">For what it’s worth, I’ll explain what the line is doing from an application perspective.</p>
<p dir="auto">This script runs in BMC’s TrueSight Server Automation as an NSH script. NSH is based on the ZShell. The syntax of the command is such that the subshell command “nexec” is doing a remote shell execution on a target server to create a symbolic link, echo the result with a “RESULT=” prefix, waits 5 seconds, and then does a find command to list out the contents of the /opt path looking for symbolic links.</p>
<p dir="auto">The output looks similar to this:</p>
<pre><code>RESULT=0
nexec -i -l algebs.ds.cpr.ca "/bin/find /opt -type l -ilname '*mqm*' -ls"
      867      0 lrwxrwxrwx   1  mqm      mqm            21 Nov  9  2021 /opt/mqm/bin -&gt; /usr/mqm/MQSV9202/bin
</code></pre>
<p dir="auto">Thanks!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/86965</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/86965</guid><dc:creator><![CDATA[greg-michael]]></dc:creator><pubDate>Sat, 10 Jun 2023 00:18:51 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Fri, 09 Jun 2023 22:20:29 GMT]]></title><description><![CDATA[<p dir="auto">The following two lines in the <code>ptc_symlink</code>-function are the problem:</p>
<pre><code class="language-bash">LINKCMDOUT="$( nexec -i -l ${DSSVR} "${(e)BASELINKCMD} 2&gt;/dev/null \
; echo -e \"RESULT=\$?\" ; sleep 5 ; ${FINDCMD} /opt -maxdepth 1 -type l -ilname '*mqm*' -ls 2&gt;/dev/null" )"
</code></pre>
<p dir="auto">When you escape two additional double-quotes, refresh or save the file, the <code>fix_install</code>-function is listed<br />
e.g.</p>
<pre><code class="language-bash">LINKCMDOUT="$( nexec -i -l ${DSSVR} \"${(e)BASELINKCMD} 2&gt;/dev/null \
; echo -e \"RESULT=\$?\" ; sleep 5 ; ${FINDCMD} /opt -maxdepth 1 -type l -ilname '*mqm*' -ls 2&gt;/dev/null\" )"
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/86959</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/86959</guid><dc:creator><![CDATA[MAPJe71]]></dc:creator><pubDate>Fri, 09 Jun 2023 22:20:29 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Fri, 09 Jun 2023 21:10:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/greg-michael" aria-label="Profile: greg-michael">@<bdi>greg-michael</bdi></a></p>
<p dir="auto">I think something went wrong with the cut and pastes, from line 403 on it lexes as a string:</p>
<p dir="auto"><img src="/assets/uploads/files/1686345004221-6f87ede3-fe92-413e-88e4-4da88782d6d3-image.png" alt="6f87ede3-fe92-413e-88e4-4da88782d6d3-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/86956</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/86956</guid><dc:creator><![CDATA[Michael Vincent]]></dc:creator><pubDate>Fri, 09 Jun 2023 21:10:06 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Fri, 09 Jun 2023 20:32:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a> Part 5</p>
<pre><code>################################################################################
# ptc_symlink
################################################################################
ptc_symlink()
{
print_msg "\n(${MM}/${DD} $(date +%R)) Started ptc_symlink" "debug"

unset BASELINKCMD DELLINKCHK DSSVR LINKCHK LINKCMDOUT

local BASELINKCMD="${(e)LINKCMD}"
local DELLINKCHK=""
local DSSVR="${1}"
local LINKCHK=""
local LINKCMDOUT=""

# Check for existence of /opt/mqm symbolic link to /usr/mqm/MQCV
LINKCHK="$( find //${DSSVR}/opt -maxdepth 1 -type l -ls 2&gt;/dev/null | grep -icE 'lrwx.*mqm[ \t]*-&gt;' )"

print_msg "BASELINKCMD=${(e)BASELINKCMD}~nLINKCHK=${LINKCHK}~nOPTDIR=${OPTDIR}~n\
UNINSTALL=${UNINSTALL}" "debug"

if &lsqb;&lsqb; ${UNINSTALL} == 1 &amp;&amp; ${LINKCHK} == 1 &rsqb;&rsqb;
  then
    # Uninstalling - remove symbolic link
    BASELINKCMD='find /opt -maxdepth 1 -type l -ilname '*mqm*' -exec /bin/rm -vf {} \;'
    if (( DRYRUN ))
      then
        print_msg "\nnexec -i -l ${DSSVR} \"${(e)BASELINKCMD}\"" "dryrun"
      else
        LINKCMDOUT="$( nexec -i -l ${DSSVR} ${(e)BASELINKCMD} )"
        print_msg "BASELINKCMD=${(e)BASELINKCMD}~nLINKCMDOUT=${LINKCMDOUT}" "debug"
        DELLINKCHK="$( ${LINKCHK} | grep -icE '^l.*mqm -&gt;' )"
        if &lsqb;&lsqb; ${DELLINKCHK} != 0 &rsqb;&rsqb;
          then
            ERRORDESC="ERROR 125: Failed to remove /opt/mqm symbolic link on ${DSSVR}"
            let ERROR_CODE=125
            if &lsqb;&lsqb; -n "${LINKCMDOUT}" &rsqb;&rsqb; ; then print_msg "LINKCMDOUT=\n${LINKCMDOUT}" ; fi
            critical_error
        fi
    fi
  elif &lsqb;&lsqb; ${UNINSTALL} == 0 &rsqb;&rsqb;
    then
      if &lsqb;&lsqb; ${OPTDIR} == 1 &rsqb;&rsqb;
        then
          # Force uninstallation of PTC MQ Client from /opt/mqm
          export UNINSTALL=1
          rollback_mq ${DSSVR}
          # Reset UNINSTALL and OPTDIR values
          export UNINSTALL=0
          export OPTDIR=0
          # Create symbolic link for /opt/mqm -&gt; /usr/mqm/MQCV
          ptc_symlink ${DSSVR}
          # Reset environment checks
          env_check ${DSSVR}
        elif &lsqb;&lsqb; ${LINKCHK} == 0 &rsqb;&rsqb;
          then
            print_msg "Symbolic link not found in /opt/mqm on ${DSSVR} - creating it"
            unset LINKCHK
            if (( DRYRUN ))
              then
                print_msg "\nnexec -i -l ${DSSVR} \"${(e)BASELINKCMD} ; sleep 5\"" "dryrun"
              else
                LINKCMDOUT="$( nexec -i -l ${DSSVR} "${(e)BASELINKCMD} 2&gt;/dev/null \
; echo -e \"RESULT=\$?\" ; sleep 5 ; ${FINDCMD} /opt -maxdepth 1 -type l -ilname '*mqm*' -ls 2&gt;/dev/null" )"

                let LINKCHK="$( find //${DSSVR}/opt -maxdepth 1 -type l -ls 2&gt;/dev/null | \
grep -icE 'l[wrx]{3}.*mqm -&gt;' )"

                print_msg "BASELINKCMD=${(e)BASELINKCMD}~nLINKCHK=${LINKCHK}~n\
LINKCMDOUT=${LINKCMDOUT}" "debug"

                if &lsqb;&lsqb; ${LINKCHK} == 0 &rsqb;&rsqb;
                  then
                    ERRORDESC="ERROR 124: Failed to create /opt/mqm symbolic link on ${DSSVR}"
                    let ERROR_CODE=124
                    if &lsqb;&lsqb; -n "${LINKCMDOUT}" &rsqb;&rsqb; ; then print_msg "LINKCMDOUT=\n${LINKCMDOUT}" ; fi
                    critical_error
                fi
            fi
      fi
fi

print_msg "\n(${MM}/${DD} $(date +%R)) End ptc_symlink" "debug"
}
################################################################################
# fix_install
################################################################################
fix_install()
{
print_msg "\n(${MM}/${DD} $(date +%R)) Started fix_install" "debug"

unset FIXFILE FIXRPMS FIXRPMSBASE FIXRPMSFP FIXSVR MQFIXCMD MQFIXCMDOUT

local FIXFILE="${MQINSTBASE}${MQVERSION}.tar.gz"
local FIXRPMS="${2}"
local FIXRPMSBASE=""
local FIXRPMSFP=""
local FIXSVR="${1}"
local MQFIXCMD=""
local let MQFIXCMDOUT=99

FIXRPMS="$( for rpm in $(echo -e "${FIXRPMS}") ; do echo -n "${rpm}${RPMSUFFIX} " ; done )"
#GVM#FIXRPMSBASE="$( echo -e "${FIXRPMS}" | grep -ivE "(BES|${MQVERBASEERE}[^0])" | tr -s '\n' ' ' )"
#GVM#FIXRPMSFP="$( echo -e "${FIXRPMS}" | grep -ivE "(BES|${MQVERBASEERE}0)" | tr -s '\n' ' ' )"
FIXRPMSBASE="$( for rpm in $( echo -e "${FIXRPMS}" ) ; do echo -n "${DATAPATH}/MQCV/${rpm}" | \
grep -ivE "(BES|${MQVERBASEERE}[^0])" ; done )"

FIXRPMSBASE="$( echo -e "${FIXRPMSBASE}" | tr '\n' ' ' )"
FIXRPMSFP="$( for rpm in $( echo -e "${FIXRPMS}" ) ; do echo -n "${DATAPATH}/MQCV/${rpm}" | \
grep -ivE "(BES|${MQVERBASEERE}0)" ; done )"

FIXRPMSFP="$( echo -e "${FIXRPMSFP}" | tr '\n' ' ' )"
MQFIXCMD="${RPMINST} --force ${FIXRPMSFP} 2&gt;&amp;1 ; echo -e \"RESULT=\$?\""
print_msg "FIXFILE=${FIXFILE}~n\nFIXRPMS=${FIXRPMS}~n\nFIXRPMSBASE=${FIXRPMSBASE}~n\
\nFIXRPMSFP=${FIXRPMSFP}~nFIXSVR=${FIXSVR}~n\nMQFIXCMD=${MQFIXCMD}~nMQFIXCMD=${MQFIXCMD}" "debug"

if (( DRYRUN ))
  then
    print_msg "copy_files ${FIXSVR} ${SOURCESVR} \"${(e)SOURCEDIR}${PATCHVER}\" \"${FIXFILE}\"" "dryrun"
    print_msg "MQFIXCMDOUT=\"\$( nexec -i -l ${FIXSVR} \"${MQFIXCMD}\" )\"" "dryrun"
  else
    copy_files ${FIXSVR} ${SOURCESVR} "${(e)SOURCEDIR}${PATCHVER}" "${FIXFILE}"
    MQFIXCMDOUT="$( nexec -i -l ${FIXSVR} "${MQFIXCMD}" )"
    print_msg "\nMQFIXCMDOUT=${MQFIXCMDOUT}" "debug"
    if &lsqb;&lsqb; $( echo -e "${MQFIXCMDOUT}" | grep -i "RESULT=" | \
sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' | cut -f2 -d'=' ) != 0 &rsqb;&rsqb;

      then
        ERRORDESC="ERROR 140: Errors detected after fixing install on ${FIXSVR}"
        let ERROR_CODE=140
        if &lsqb;&lsqb; -n "${MQFIXCMDOUT}" &rsqb;&rsqb; ; then print_msg "MQFIXCMDOUT=\n${MQFIXCMDOUT}" ; fi
        critical_error
    fi
fi

print_msg "\n(${MM}/${DD} $(date +%R)) End fix_install" "debug"
}
################################################################################
# Main
################################################################################
# Check for log path. Create if not found.
if &lsqb;&lsqb; -d '/tmp' &rsqb;&rsqb;
  then
    export LOGPATH='/tmp'
  elif &lsqb;&lsqb; -d '/C/Temp' &rsqb;&rsqb;
    then
      export LOGPATH='/C/Temp'
fi
if &lsqb;&lsqb; ! -d "${LOGPATH}" &rsqb;&rsqb; ; then mkdir -p "${LOGPATH}" ; fi

# Files
LOGFILE="${LOGPATH}/${NSH}.${MMDD}"
MAILFILE="${LOGPATH}/${NSH}.mail"
TMPLOG="${LOGPATH}/${NSH}.$$.${MMDD}${YYYY}${HH}${MIN}.log"

# Clean up prior log file
if &lsqb;&lsqb; -f ${TMPLOG} &rsqb;&rsqb; ; then rm -f ${TMPLOG} ; fi

print_msg "\n(${MM}/${DD} $(date +%R)) Started ${NSH}"

# Validate number of arguments given
if &lsqb;&lsqb; ! $# -ge 2 &rsqb;&rsqb; ; then let ERROR_CODE=0 ; usage ; fi

# leading ':' enables quiet processing with '?' and ':' as values when problems
# are encountered.
# trailing ':' indicates that an option requires an argument.
while getopts ":dhp:Rs:Uy" OPT
   do
     case "${OPT}" in
         d|D) # Enable DEBUG
              let DEBUG=1
              print_msg "DEBUG MODE ENABLED"
              print_msg "DEBUG=${DEBUG}" "debug"
              ;;
         h|H) # Help/usage
              usage
              ;;
         p|P) # Patch version to install
              if &lsqb;&lsqb; $( awk -v num=${OPTARG} 'BEGIN {if (num ~ /[0-9]+/) { print "1" }}' ) == 1 &rsqb;&rsqb;
                then
                  let PATCHVER=${OPTARG}
                  print_msg "PATCHVER=${PATCHVER}" "debug"
                else
                  ERRORDESC="ERROR 100: Unrecognized Patch Version: ${OPTARG}"
                  let ERROR_CODE=100
                  critical_error
              fi
              ;;
           R) # Rollback/uninstall MQ Client
              let ROLLBACK=1
              print_msg "ROLLBACK PROCESSING"
              print_msg "ROLLBACK=${ROLLBACK}" "debug"
              ;;
         s|S) # Host list
              HOSTS="${OPTARG}"
              if &lsqb;&lsqb; $( echo -e "${HOSTS}" | awk '{if ($0 ~ /(,|;|:|\t)/) {print "1"} else {print "0"}}' ) -ge 1 &rsqb;&rsqb;
                then
                  HOSTS="$( echo -e "${HOSTS}" | tr -s ',:;\t' ' ' )"
              fi
              print_msg "HOSTS=${HOSTS}" "debug"
              ;;
           U) # Uninstall MQ Client
              let UNINSTALL=1
              print_msg "UNINSTALL PROCESSING"
              print_msg "UNINSTALL=${UNINSTALL}" "debug"
              ;;
         y|Y) # Enable DRYRUN
              let DRYRUN=1
              print_msg "Executing DRYRUN"
              print_msg "DRYRUN=${DRYRUN}" "debug"
              ;;
         \?) # Invalid option
              print_msg "Invalid option ${OPTARG} provided"
              usage
              ;;
         \:) # Missing required argument to option
              print_msg "Option ${OPTARG} requires an argument."
              usage
              ;;
     esac
done

# remove processed options leaving what remains as $@
shift $(( OPTIND - 1 ))
if &lsqb;&lsqb; -n "$@" &rsqb;&rsqb; ; then print_msg "\$@=$@" "debug" ; fi

# ROLLBACK and UNINSTALL are mutually exclusive
if &lsqb;&lsqb; ${UNINSTALL} == 1  &amp;&amp; ${ROLLBACK} == 1 &rsqb;&rsqb;
  then
    print_msg "Rollback and Uninstall options are mutually exclusive"
    usage
fi

# Check for tarball on source server
# (e) Perform parameter expansion, command substitution and arithmetic expansion
# on the result.
#
# Expected tar file name format: MQCV-9.2.0-X.tar.gz
#
TARBALL="$( ls //${SOURCESVR}${SOURCEPATH} 2&gt;/dev/null | \
grep -iE "${(e)SOURCEFILES}" | sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' | sort -d )"

TARNUM=$( echo -e "${TARBALL}" | grep -icE "${(e)SOURCEFILES}" )

#GVM#print_msg "\nTARBALL=\n$( echo -e "${TARBALL}" | sed 's/\(^.*$\)/\\t\1/g' )\
#GVM#~nTARNUM=${TARNUM}" "debug"
print_msg "~nTARBALL=\n$( echo -e "${TARBALL}" | sed 's/\(^.*$\)/\\t\1/g' )\
~nTARNUM=${TARNUM}" "debug"

# If PATCHVER is not passed in as an argument, determine most recent patch level
# based on tarball name on source server
if &lsqb;&lsqb; ${TARNUM} -ge 1 &amp;&amp; ${PATCHVER} == 0 &rsqb;&rsqb;
  then
    let PATCHVER="$( echo -e "${TARBALL}" | tail -n 1 | awk '{
print substr($0,index($0,".tar.gz")-1,1) }' )"

    print_msg "PATCHVER=${PATCHVER}" "debug"
fi

# Validate PATCHVER is set and use it to set TARFILE
if &lsqb;&lsqb; ${PATCHVER} == 0 &rsqb;&rsqb;
  then
    ERRORDESC="ERROR 101: Failed to set Patch Version"
    let ERROR_CODE=101
    critical_error
  else
#GVM#    TARFILE="$( echo -e "${TARBALL}" | grep -iE "${MQVERBASE}${PATCHVER}" )"
#GVM#    TARFILE="$( echo -e "${TARBALL}" | grep -iE "${MQVERBASEERE}${PATCHVER}" )"
    TARFILE="$( echo -e "${TARBALL}" | \
grep -iE "${MQVERBASEERE}${PATCHVER}" | sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' | tail -n 1 )"
#GVM#    print_msg "TARFILE=${TARFILE}" "debug"
    if &lsqb;&lsqb; ! -n ${TARFILE} &rsqb;&rsqb;
      then
        ERRORDESC="ERROR 102: Failed to set TARFILE"
        let ERROR_CODE=102
        critical_error
      else
        # (e) expand variable first
        # #*- strip off all characters up to and including the first '-'
        # /.tar.gz search and remove '.tar.gz'
        # %-* print all characters up to and including the first '-'
        # starts with MQCV-9.3.0-4.tar.gz
        # ends with 9.3.0-
        MQVERBASE="$( echo -e "${${${(e)TARFILE#*-}/.tar.gz}%-*}-" )"
        # strip all '.' and '-' characters
        typeset -i BASECMDLVL=$( echo -e "${MQVERBASE}" | tr -d '.-' )
        MQUPBASE="U$( echo -e "${BASECMDLVL}" )"
        print_msg "TARFILE=${TARFILE}~nBASECMDLVL=${BASECMDLVL}~nMQUPBASE=${MQUPBASE}\
~nMQVERBASE=${MQVERBASE}" "debug"

    fi
fi

# Build RPM lists
if (( ! UNINSTALL ))
  then
    for rpm in ${MQRPMS}
       do
         RPMINSTLIST+="${DATAPATH}/MQCV/${rpm}${MQINSTBASE}${MQVERBASE}${MQVERBASEMIN}${RPMPLATFORM}\
${RPMSUFFIX} "

         RPMUPLIST+="${DATAPATH}/MQCV/${rpm}${MQINSTBASE}${MQUPBASE}${PATCHVER}-\
${MQVERBASE}${PATCHVER}${RPMPLATFORM}${RPMSUFFIX} "

    done
    print_msg "\nRPMINSTLIST=${RPMINSTLIST}~n\nRPMUPLIST=${RPMUPLIST}" "debug"
fi

# Process hosts list one server at a time
for host in ${HOSTS}
   do
     print_msg "Processing ${host}"
     # Validate environment
     env_check ${host}
     # If uninstalling or rolling back
     if (( ROLLBACK || UNINSTALL ))
       then
         # If no install is found
         if &lsqb;&lsqb; ${EXISTING} == 0 &amp;&amp; ${NEWINST} == 0 &rsqb;&rsqb;
           then
             print_msg "No installations of MQ Client found on ${host}"
           # Verify requested version to rollback matches installed version
#GVM#           elif (( PATCHVER &lt; VER &amp;&amp; MAJVER &gt;= 9 ))
           elif &lsqb;&lsqb; ${BASECMDLVL}${PATCHVER} &lt; ${MAXCMDLVL}${VER} &amp;&amp; ${MAJVER} -ge 9 &rsqb;&rsqb;
             then
               ERRORDESC="ERROR 103: Requested version to rollback \
\"${MQVERBASE}${PATCHVER}\" is below installed version \"${MQVERBASE}${VER}\""

               let ERROR_CODE=103
               critical_error
             else
               # Perform rollback on host
               rollback_mq ${host}
         fi
       # If host is already running requested patch version
#GVM#       elif &lsqb;&lsqb; ${PATCHVER} == ${VER} &rsqb;&rsqb;
       elif &lsqb;&lsqb; ${BASECMDLVL}${PATCHVER} == ${MAXCMDLVL}${VER} &rsqb;&rsqb;
         then
           print_msg "${host} is already running version ${MQVERBASE}${PATCHVER}"
           if (( BESINSTALL )) ; then install_bes ${host} ; fi
         else
           # Install or apply Fix Pack
           # Create /opt/mqm symbolic link for PTC environment
           if (( PTC )) ; then ptc_symlink ${host} ; fi
           # Copy files to target
           # Avoid copying files twice if BASECMDLVL &gt; MAXCMDLVL (9.3.0 &gt; 9.2.0)
#GVM#           if &lsqb;&lsqb; ${ROLLBACK} == 0 &amp;&amp; ${UNINSTALL} == 0 &rsqb;&rsqb;
           if &lsqb;&lsqb; ${ROLLBACK} == 0 &amp;&amp; ${UNINSTALL} == 0 &amp;&amp; ${BASECMDLVL} &gt; ${MAXCMDLVL} &rsqb;&rsqb;
             then
#GVM#               copy_files ${host} ${SOURCESVR} "${SOURCEDIR}${PATCHVER}" "${TARFILE}"
               copy_files ${host} ${SOURCESVR} "${(e)SOURCEDIR}${PATCHVER}" "${TARFILE}"
           fi
           # Install BESAgent if not installed
           if (( BESINSTALL )) ; then install_bes ${host} ; fi
#GVM#           if (( NEWINST ))
           if &lsqb;&lsqb; ${NEWINST} == 1 || ${MAXCMDLVL} &lt; ${BASECMDLVL} &rsqb;&rsqb;
             then
               # New install
               install_mq ${host} "${RPMINSTLIST}"
             else
               # Fix Pack install
               install_mq ${host} "${RPMUPLIST}"
           fi
           # Clean up RPMs and tarballs
           # ':=' If unset or null, set DATAPATH to /var/mqm to prevent any possibility
           # of acting on files in the / file system
           if (( DRYRUN ))
             then
#GVM#               print_msg "\nnexec -i -l ${host} \"/bin/rm -dfR \
#GVM#${DATAPATH:=/var/mqm}/MQCV ; /bin/rm -dfR ${DATAPATH:=/var/mqm}/BESClient\"" "dryrun"
               print_msg "\nnexec -i -l ${host} \"/bin/rm -dfR \
${DATAPATH:=/var/mqm}/MQCV ; /bin/rm -f ${DATAPATH:=/var/mqm}/MQCV-*.*.*-*.tar.gz ; \
/bin/rm -dfR ${DATAPATH:=/var/mqm}/BESClient\"" "dryrun"

             else
#GVM#               nexec -i -l ${host} "/bin/rm -dfR ${DATAPATH:=/var/mqm}/MQCV ; \
#GVM#/bin/rm -dfR ${DATAPATH:=/var/mqm}/BESClient"
#GVM#               nexec -i -l ${host} "/bin/rm -dfR ${DATAPATH:=/var/mqm}/MQCV ; \
#GVM#/bin/rm -f ${DATAPATH:=/var/mqm}/MQCV-*.*.*-*.tar.gz ; /bin/rm -dfR ${DATAPATH:=/var/mqm}/BESClient"
               nexec -i -l ${host} "${(e)CLEANCMD}"
           fi
     fi
     # Skip copying log file for dry run
     if (( ! DRYRUN ))
       then
         if (( UNINSTALL ))
           then
             cp ${TMPLOG} //${host}${MQCVPATH}/${NSH}.${MMDD}${YYYY}${HH}${MIN}.uninstall.log
           else
             cp ${TMPLOG} //${host}${MQCVPATH}/${NSH}.${MMDD}${YYYY}${HH}${MIN}.log
         fi
     fi
done

print_msg "\n(${MM}/${DD} $(date +%R)) Finished ${NSH}"
#-------------------------------------------------------------------------------
# Retention is listed below at 90 days for logs and datafiles. Ask user of
# process for actual retention specifications and change accordingly.
#-------------------------------------------------------------------------------
CURRDIR="${PWD}"
cd "${LOGPATH}"
find -path "${LOGPATH}" \( -name ${NSH}'.*.log' -o -name 'delete.*' \) -mtime +90 \
-exec /bin/rm -f {} \; 2&gt;&gt;${LOGPATH}/delete.${MMDD}

cd "${CURRDIR}"

# Process log files and exit
critical_error
#END
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/86954</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/86954</guid><dc:creator><![CDATA[greg-michael]]></dc:creator><pubDate>Fri, 09 Jun 2023 20:32:00 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Fri, 09 Jun 2023 20:31:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a> Part 4</p>
<pre><code>################################################################################
# install_mq
################################################################################
install_mq()
{
print_msg "\n(${MM}/${DD} $(date +%R)) Started install_mq" "debug"

unset INSTSERVER MQINSTCMD MQINSTOUT RESULT RPMS SETMQINSTCMD

# Cannot use local INSTSERVER or it gets reset after calling rollback_mq
INSTSERVER="${1}"
local MQINSTCMD=""
local MQINSTOUT=""
local RPMS="${2}"
local RESULT=99
local SETMQINSTCMD="${SETMQINST}"

if (( NEWINST ))
  then
    MQINSTCMD="${RPMINST} ${RPMS} 2&gt;&amp;1 | tee /tmp/mqinstall.log ; echo -e \"RESULT=\$?\""
  else
    #GVM#
    # If we're upgrading minor versions (9.2 -&gt; 9.3) MAXCMDLVL will be &lt; BASECMDLVL
    # so install base RPMs first.
    if &lsqb;&lsqb; ${MAXCMDLVL} &lt; ${BASECMDLVL} &rsqb;&rsqb;
      then
        #GVM#        print_msg "Currently installed version is below v${MQVERBASE}${MQVERBASEMIN}. Proceeding with removal."
        print_msg "Currently installed version ${MQVERSION} is below v${MQVERBASE}${MQVERBASEMIN}. \
Proceeding with replacement."

        export UNINSTALL=1
        rollback_mq ${INSTSERVER}
        export UNINSTALL=0
        # Reset environment variables
        env_check ${INSTSERVER}
        copy_files ${INSTSERVER} ${SOURCESVR} "${(e)SOURCEDIR}${PATCHVER}" "${TARFILE}"
    fi
    MQINSTCMD="${RPMUPDATE} ${RPMS} 2&gt;&amp;1 | tee /tmp/mqinstall.log ; echo -e \"RESULT=\$?\""
fi

#GVM## Prevent attempts to execute setmqinst if it doesn't exist
#GVM#if &lsqb;&lsqb; ! -f //${INSTSERVER}/${MQCVPATH}/bin/setmqinst &rsqb;&rsqb;
#GVM#  then
#GVM#    SETMQINSTCMD=""
#GVM#fi

print_msg "\nMQINSTCMD=${MQINSTCMD}~n\nRPMS=${RPMS}~nINSTSERVER=${INSTSERVER}\
~nSETMQINSTCMD=${SETMQINSTCMD}" "debug"

if (( DRYRUN ))
  then
#GVM#    print_msg "\nnexec -i -l ${INSTSERVER} \"${MQLICENSE} ; ${SETMQINSTCMD}\"" "dryrun"
#GVM#    print_msg "\nnexec -i -l ${INSTSERVER} \"${MQINSTCMD}\"" "dryrun"
    # Prevent attempts to execute setmqinst if it doesn't exist
    if &lsqb;&lsqb; ! -f //${INSTSERVER}/${MQCVPATH}/bin/setmqinst &rsqb;&rsqb;
      then
#GVM#        SETMQINSTCMD=""
        print_msg "\nnexec -i -l ${INSTSERVER} \"${MQLICENSE}\"" "dryrun"
      else
        print_msg "\nnexec -i -l ${INSTSERVER} \"${MQLICENSE} ; ${SETMQINSTCMD}\"" "dryrun"
    fi
    print_msg "\nnexec -i -l ${INSTSERVER} \"${MQINSTCMD}\"" "dryrun"
  else
    # Prevent attempts to execute setmqinst if it doesn't exist
    if &lsqb;&lsqb; -f //${INSTSERVER}/${MQCVPATH}/bin/setmqinst &rsqb;&rsqb;
      then
        # Accept license and set Primary Instance
        MQLICOUT="$( nexec -i -l ${INSTSERVER} "${MQLICENSE} ; ${SETMQINSTCMD}" 2&gt;/dev/null )"
        print_msg "\nMQLICOUT=\n${MQLICOUT}" "debug"
    fi
    # install MQ client
    MQINSTOUT="$( nexec -i -l ${INSTSERVER} "${MQINSTCMD}" )"
    let RESULT=$( echo -e "${MQINSTOUT}" | grep "RESULT=" | \
sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' | cut -f2 -d '=' )

#GVM#    print_msg "\nMQLICOUT=\n${MQLICOUT}~n\nMQINSTOUT=\n${MQINSTOUT:-'no output'}~n\
#GVM#RESULT=${RESULT}" "debug"
    print_msg "\nMQINSTOUT=\n${MQINSTOUT:-'no output'}~nRESULT=${RESULT}" "debug"
fi

if (( ! DRYRUN ))
  then
    if &lsqb;&lsqb; ${RESULT:=99} == 0 &rsqb;&rsqb;
      then
        env_check ${INSTSERVER}
        print_msg "PATCHVER=${PATCHVER}~nVER=${VER}" "debug"
        # Validate installation
        if &lsqb;&lsqb; ${EXISTING} != 1 || ${#INSTPATH} == 0 &rsqb;&rsqb;
          then
            ERRORDESC="ERROR 117: Failed to set Primary Instance on ${INSTSERVER}"
            let ERROR_CODE=117
            if &lsqb;&lsqb; -n "${MQLICOUT}" &rsqb;&rsqb; ; then print_msg "MQLICOUT=\n${MQLICOUT}" ; fi
            critical_error
          # if installed version VER is below the patch version PATCHVER, install patch RPMs
#GVM#          elif &lsqb;&lsqb; ${PATCHVER} -gt ${VER} &rsqb;&rsqb;
          elif &lsqb;&lsqb; ${BASECMDLVL}${PATCHVER} -gt ${MAXCMDLVL}${VER} &rsqb;&rsqb;
            then
              # Validate proper installation
              if &lsqb;&lsqb; ${RPMCHKOUT} &gt; 8 &amp;&amp; ${RPMMQBASECNT} != 8 &rsqb;&rsqb;
                then
                  ERRORDESC="ERROR 137: Improper installation detected!"
                  ERRORDESC+=" Missing ${MQSeries}*-${MQVERBASE}${MQVERBASEMIN} RPMs!"
                  let ERROR_CODE=137
                  critical_error
              fi
              print_msg "Upgrading MQ Client version ${MQVERBASE}${VER} \
found at ${INSTPATH} on ${INSTSERVER}"

              install_mq ${host} "${RPMUPLIST}"
              # Accept license and set Primary Instance
              MQLICOUT="$( nexec -i -l ${host} "${MQLICENSE} ; ${SETMQINSTCMD}" )"
              print_msg "\nMQLICOUT=\n${MQLICOUT}" "debug"
        fi
        # Validate license status
        if [ "x${LICCHK}" = "xLicense not accepted" ]
          then
            ERRORDESC="ERROR 118: Failed to install license on ${INSTSERVER}"
            let ERROR_CODE=118
            if &lsqb;&lsqb; -n "${MQLICOUT}" &rsqb;&rsqb; ; then print_msg "MQLICOUT=\n${MQLICOUT}" ; fi
            critical_error
        fi
      else
        ERRORDESC="ERROR 116: Errors encountered during install/upgrade on ${INSTSERVER}"
        let ERROR_CODE=116
        if &lsqb;&lsqb; -n "${MQINSTOUT}" &rsqb;&rsqb; ; then print_msg "MQINSTOUT=\n${MQINSTOUT}" ; fi
        critical_error
    fi
fi

print_msg "\n(${MM}/${DD} $(date +%R)) End install_mq" "debug"
}
################################################################################
# rollback_mq
################################################################################
rollback_mq()
{
print_msg "\n(${MM}/${DD} $(date +%R)) Started rollback_mq" "debug"

#GVM#unset COUNT MQRPMS QSTRING RESULT RMFILES RMMQRPMS RMMQRPMSOUT RMSERVER
unset COUNT _MQRPMSRB QSTRING RESULT RMFILES RMMQRPMS RMMQRPMSOUT RMSERVER
unset RPMLIST SVRMINVER UNINSTOUT VERQUERY VERS

local COUNT=0
#GVM#local MQRPMS=""
local _MQRPMSRB=""
local QSTRING=""
local RESULT=0
local RMFILES=""
local RMMQRPMS=""
local RPMCHECKOUT=0
local RPMLIST=""
local RMSERVER="${1}"
local SVRMINVER=0
local UNINSTOUT=""
local VERQUERY=""
local VERS=""

#GVM#MQRPMS="$( nexec -i -l ${RMSERVER} "${RPM_CMD} -qa | grep -iE \"${RPMBASE}.*_${MQINSTBASE}\" \
# Generate listing of installed RPMs
_MQRPMSRB="$( nexec -i -l ${RMSERVER} "${RPM_CMD} -qa | ${GREPNC} -iE \"${RPMBASE}.*_${MQINSTBASE}\" \
| ${GREPNC} -iv \"${MQSERVERRPM}\"" | sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' )"

VERQUERY='s/^${RPMBASE}.*_${MQINSTBASE}\(.*\)${RPMPLATFORM}/\1/g'
#GVM#VERS="${MQINSTBASE}${MQVERBASE}${MQVERBASEMIN}"
VERS="${MQINSTBASE}${MQVERBASEERE}${MQVERBASEMIN}"

#GVM#SVRMINVER="$( echo -e "${MQRPMS}" | grep -iE "${RPMBASE}.*_${MQINSTBASE}" | \

SVRMINVER="$( echo -e "${_MQRPMSRB}" | grep -iE "${RPMBASE}.*_${MQINSTBASE}" | \
grep -vE "(${VERS})" | sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g'| sed -e "${(e)VERQUERY}" | sort -u | \
awk '{print substr($0,length($0),1)}' | head -n 1 )"

#GVM#print_msg "\nMQRPMS=${MQRPMS}~nRMSERVER=${RMSERVER}~nSVRMINVER=${SVRMINVER}~n\

print_msg "\n_MQRPMSRB=${_MQRPMSRB}~nRMSERVER=${RMSERVER}~nSVRMINVER=${SVRMINVER}~n\
VERQUERY=${VERQUERY}~nVERS=${VERS}" "debug"

# If roll back requested and PATCHVER is not higher than SVRMINVER, cannot roll back
# := if SVRMINVER is null or unset, expand to 0 instead
if &lsqb;&lsqb; ! ${SVRMINVER:=0} -lt ${PATCHVER} &amp;&amp; ${UNINSTALL} != 1 &rsqb;&rsqb;
  then
    echo -e "${STARS}\nRollback requested and Patch Version ${PATCHVER} \
is the only removeable version. Run ${NSH} with -U option to uninstall.\n\
${STARS}" | fold -sw 80

    usage
fi

# Perform Patch Removal or complete uninstall
if (( UNINSTALL == 0 ))
  then
#GVM#    if &lsqb;&lsqb; ${FPVER} == 0 &rsqb;&rsqb;
    if &lsqb;&lsqb; ${VER} == 0 &rsqb;&rsqb;
      then
        ERRORDESC="ERROR 133: Rollback requested, but no Fix Packs are installed \
on server ${RMSERVER}"

        let ERROR_CODE=133
        critical_error
      else
        print_msg "Downgrading MQ Client version ${MQVERBASE}${VER} found at \
${INSTPATH} on ${RMSERVER}"

        # Build list of Patch RPMs to remove
#GVM#        QSTRING="(${MQINSTBASE}${MQUPBASE}${FPVER}-${MQVERBASE}${FPVER})"
        QSTRING="(${MQINSTBASE}${MQUPBASE}${VER}-${MQVERBASE}${VER})"
        RMMQRPMS="${RPM_CMD} -ev \$( rpm -qa | ${GREPNC} -E \"${QSTRING}\" | \
sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' ) 2&gt;&amp;1"

        COUNT="$( nexec -i -l ${SERVER} "rpm -qa | ${GREPNC} -cE \"${QSTRING}\"" )"
        if &lsqb;&lsqb; ${COUNT} == 0 &rsqb;&rsqb;
          then
            ERRORDESC="ERROR 131: No ${MQVERBASE}${PATCHVER} patches found on ${RMSERVER}"
            let ERROR_CODE=131
            critical_error
        fi
        print_msg "\nCOUNT=${COUNT}~nQSTRING=\n${QSTRING}~n\nRMMQRPMS=\n${RMMQRPMS}" "debug"
        if (( DRYRUN ))
          then
            print_msg "\nnexec -i -l ${RMSERVER} \"${RMMQRPMS}\" ; echo -e \"RESULT=\$?\"" "dryrun"
          else
            UNINSTOUT="$( nexec -i -l ${RMSERVER} "${RMMQRPMS} ; echo -e \"RESULT=\$?\"" )"
            let RESULT=$( echo -e "${UNINSTOUT}" | grep "RESULT=" | \
sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' | cut -f2 -d'=' )

            print_msg "\nUNINSTOUT=${UNINSTOUT}~nRESULT=${RESULT}" "debug"
            if &lsqb;&lsqb; ${RESULT} != 0 &rsqb;&rsqb;
              then
                ERRORDESC="ERROR 119: Errors encountered during uninstall/downgrade on ${RMSERVER}"
                let ERROR_CODE=119
                if &lsqb;&lsqb; -n "${UNINSTOUT}" &rsqb;&rsqb; ; then print_msg "UNINSTOUT=\n${UNINSTOUT}" ; fi
                critical_error
              else
                # Set Primary Instance
                if (( DRYRUN ))
                  then
                    print_msg "\nnexec -i -l ${RMSERVER} \"${SETMQINST}\"" "dryrun"
                  else
                    MQINSTOUT="$( nexec -i -l ${RMSERVER} "${SETMQINST}" )"
                    print_msg "\nMQINSTOUT=\n${MQINSTOUT}" "debug"
                fi
            fi
        fi
        env_check ${RMSERVER}
        # Validate that RPMs were uninstalled#
        if &lsqb;&lsqb; ! ${VER} &lt; ${PATCHVER} &rsqb;&rsqb;
          then
            ERRORDESC="ERROR 120: Failed to remove ${MQVERBASE}${PATCHVER} RPMs on ${RMSERVER}"
            let ERROR_CODE=120
            critical_error
          else
            # Validate removal and Primary Instance setting
            if &lsqb;&lsqb; ${EXISTING} != 1 || ${#INSTPATH} == 0 &rsqb;&rsqb;
              then
                ERRORDESC="ERROR 121: Failed to set Primary Instance on ${RMSERVER}"
                let ERROR_CODE=121
                if &lsqb;&lsqb; -n "${MQINSTOUT}" &rsqb;&rsqb; ; then print_msg "MQINSTOUT=\n${MQINSTOUT}" ; fi
                critical_error
            fi
        fi
    fi
  else
    # Removing MQ Client install
    #GVM#print_msg "Removing MQ Client found at ${INSTPATH} on ${RMSERVER}"
    print_msg "Removing MQ Client version ${MQVERSION} found at ${INSTPATH} on ${RMSERVER}"
    # -depth instructs find to process the directory contents before the directory
    RMFILES="${FINDCMD} ${APPPATH:=/usr/mqm} ${DATAPATH:=/var/mqm} /etc/opt/mqm "
    if (( PTC )) ; then RMFILES+="/opt/mqm " ; fi
    RMFILES+="-depth -name 'lost+found' -prune -o -path ${APPPATH:=/usr/mqm} "
    RMFILES+="-prune -o -path ${DATAPATH:=/var/mqm}/app* -prune -o -path ${DATAPATH:=/var/mqm} "
    RMFILES+="-prune -o -exec /bin/rm -df '{}' \;"
    QSTRING="${RPMBASE}.*_${MQINSTBASE}.*"
    COUNT="$( nexec -i -l ${RMSERVER} "rpm -qa | ${GREPNC} -cE \"${QSTRING}\"" | \
sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' )"

    if &lsqb;&lsqb; ${COUNT} == 0 &rsqb;&rsqb;
      then
        ERRORDESC="ERROR 132: No ${RPMBASE}*_${MQINSTBASE}*.rpm RPMs found on ${RMSERVER}"
        let ERROR_CODE=132
        critical_error
    fi

#GVM# Quiet output or get screens of periods and hashes
    if (( ! TAGCNT ))
      then
#GVM#        fix_install ${RMSERVER} "${_MQRPMSRB}"
        RMMQRPMS="${RPM_CMD} -ev --allmatches --nodeps --noscripts --notriggers"
      else
        RMMQRPMS="${RPM_CMD} -ev --allmatches"
    fi
#GVM#    if [ "x${(L)SVROS}" = "xsuse" ]
#GVM#      then
#GVM#        # -D --dry-run
#GVM#        # --no-refresh (global)
#GVM#        # -n --non-interactive (global)
#GVM#        # -q --quiet (global)
#GVM#        # -t --terse (global, implies --no-abbrev and --no-color)
#GVM#        # -u --clean-deps
#GVM#        # -v --verbose (global)
#GVM#        #
        #GVM#RMMQRPMS="${ZYPPER} -n -q -t --no-refresh rm -u"
#GVM#        RMMQRPMS="${ZYPPER} -n -t --no-refresh rm -u"
#GVM#        if (( DRYRUN )) ; then RMMQRPMS+=" --dry-run" ; fi
#GVM#    fi
#GVM#    if [ "x${(L)SVROS}" = "xredhat" ]
#GVM#      then
#GVM#        # --color=always/never/auto
#GVM#        # --comment=&lt;comment&gt;
#GVM#        # -q --quiet
#GVM#        # --setopt=&lt;option&gt;=&lt;value&gt; tsflags=test -- dry run, no exec
#GVM#        # -v --verbose
#GVM#        # -y --assumeyes
#GVM#        # 
#GVM#        #GVM#RMMQRPMS="${YUM} --color=never --comment=\"Removing MQ Client installation\" -q -y remove"
#GVM#        RMMQRPMS="${YUM} --color=never --comment=\"Removing MQ Client installation\" -y remove"
#GVM#        if (( DRYRUN )) ; then RMMQRPMS+=" --setopt=tsflags=test" ; fi
#GVM#    fi
    # If variable is unset or null, substitute value to prevent removing all RPMs
    # sort dictionary-based, field sep '-', 2nd field, reverse order
#GVM#    RMMQRPMS="${RPM_CMD} -ev --allmatches \$( rpm -qa | grep -iE \"${QSTRING:=\"_none_\"}\" ) 2&gt;&amp;1"
    if &lsqb;&lsqb; ${#RMMQRPMS} == 0 &rsqb;&rsqb;
      then
        ERRORDESC="ERROR 138: Failed to set package manager for ${RMSERVER}"
        let ERROR_CODE=138
        critical_error
      else
        RMMQRPMS+=" \$( rpm -qa | ${GREPNC} -iE \"${QSTRING:=\"_none_\"}\" | \
sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' | sort -dt '-' -k 2r ) 2&gt;/tmp/mquninstall.log"

        RMMQRPMS+=" ; let RESULT=\$? ; if &lsqb;&lsqb; \${RESULT} == 0 &rsqb;&rsqb; ; then ${RMFILES}"
        RMMQRPMS+=" ; else echo \"RMMQFAILED\" ; fi"
    fi
    print_msg "QSTRING=${QSTRING}~n\nRMMQRPMS=${RMMQRPMS}" "debug"
    if (( DRYRUN ))
      then
        print_msg "\nnexec -i -l ${RMSERVER} \"${RMMQRPMS}\"" "dryrun"
      else
        UNINSTOUT="$( nexec -i -l ${RMSERVER} "${RMMQRPMS}" )"
        let RPMCHECKOUT="$( echo -e "${UNINSTOUT}" | grep -ic "RMMQFAILED" )"
        print_msg "\nUNINSTOUT=\n${UNINSTOUT}~nRESULT=${RESULT}~nRPMCHECKOUT=\
${RPMCHECKOUT}" "debug"

        if &lsqb;&lsqb; ${RPMCHECKOUT} != 0 &rsqb;&rsqb;
          then
            ERRORDESC="ERROR 122: Failed to remove all MQ RPMs on ${RMSERVER}"
            let ERROR_CODE=122
            if &lsqb;&lsqb; -n "${UNINSTOUT}" &rsqb;&rsqb; ; then print_msg "UNINSTOUT=\n${UNINSTOUT}" ; fi
            critical_error
        fi
    fi
fi

print_msg "\n(${MM}/${DD} $(date +%R)) End rollback_mq" "debug"
}
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/86953</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/86953</guid><dc:creator><![CDATA[greg-michael]]></dc:creator><pubDate>Fri, 09 Jun 2023 20:31:16 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Fri, 09 Jun 2023 20:29:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a> Part 3</p>
<pre><code>################################################################################
# copy_files
################################################################################
copy_files()
{
print_msg "\n(${MM}/${DD} $(date +%R)) Started copy_files" "debug"

unset BASECPRESULT BKPFMT BUILDDIR CLEANCMD CPRESULT DIRCHK FILE SRCPATH SRCSVR SVR

local BASECPRESULT=0
local BKPFMT=".${DD}-${MM}-${YYYY}_${HH}${MM}"
local BUILDDIR="${3}"
local CPRESULT=0
local DIRCHK=""
local FILE="${4}"
local SRCSVR="${2}"
local SVR="${1}"

# Setup source path to copy files from
# /hamq/software/mq/client
local SRCPATH="${SRCSVR}${SOURCEPATH}"

#GVM#print_msg "BKPFMT=${BKPFMT}~nBUILDDIR=${BUILDDIR}~nFILE=${FILE}~nSRCSVR=${SRCSVR}\
#GVM#~nSVR=${SVR}" "debug"
print_msg "BKPFMT=${BKPFMT}~nBUILDDIR=${BUILDDIR}~nFILE=${FILE}~nSRCSVR=${SRCSVR}\
~nSVR=${SVR}" "debug"

# Copy install and patch files from source to target
if &lsqb;&lsqb; -n ${FILE} &rsqb;&rsqb;
  then
    # DATAPATH includes leading '/'
    # If remnants of previous tarballs remain, remove them.
    CLEANCMD='if &lsqb;&lsqb; -d ${DATAPATH:=/var/mqm}/MQCV &rsqb;&rsqb; ; then '
    CLEANCMD+='/bin/rm -dfR ${DATAPATH:=/var/mqm}/MQCV ; fi ; '
    CLEANCMD+='if &lsqb;&lsqb; \$(ls ${DATAPATH:=/var/mqm} | grep -cE "MQCV-[0-9][.][0-9]+[.][0-9]+[-][0-9]+[.]tar[.]gz(.*)?" ) &rsqb;&rsqb; ; then '
    CLEANCMD+='/bin/rm -f ${DATAPATH:=/var/mqm}/MQCV-*.*.*-*.tar.gz* ; fi ; '
    CLEANCMD+='if &lsqb;&lsqb; -d ${DATAPATH:=/var/mqm}/BESClient &rsqb;&rsqb; ; then '
    CLEANCMD+='/bin/rm -dfR ${DATAPATH:=/var/mqm}/BESClient ; fi'
    export CLEANCMD
    print_msg "\nCLEANCMD=${(e)CLEANCMD}" "debug"
#GVM#    nexec -i -l ${SVR} "/bin/rm -dfR ${DATAPATH:=/var/mqm}/MQCV ; \
#GVM#/bin/rm -dfR ${DATAPATH:=/var/mqm}/BESClient"
#GVM#    nexec -i -l ${SVR} "/bin/rm -dfR ${DATAPATH:=/var/mqm}/MQCV ; \
#GVM#/bin/rm -f ${DATAPATH:=/var/mqm}/MQCV-*.*.*-*.tar.gz ; /bin/rm -dfR ${DATAPATH:=/var/mqm}/BESClient"
    if (( DRYRUN ))
      then
        print_msg "nexec -i -l ${SVR} \"${(e)CLEANCMD}\"" "dryrun"
        print_msg "\ncp -bfuvs \"${BKPFMT}\" //${SRCPATH}/${FILE} \
//${SVR}${DATAPATH}" "dryrun"

      else
        nexec -i -l ${SVR} "${(e)CLEANCMD}"
        cp -bfuvs "${BKPFMT}" //${SRCPATH}/${FILE} //${SVR}${DATAPATH}
        let CPRESULT=$?
    fi
#GVM#  else
#GVM#    # If tarball is missing on source server, check for build directory
#GVM#    DIRCHK="$( ls -d //${SRCSVR}${BUILDDIR} )"
#GVM#    DIRCHK="$( ls -d //${SRCSVR}${BUILDDIR} 2&gt;/dev/null )"
#GVM#    print_msg "DIRCHK=${DIRCHK}" "debug"
#GVM#    if &lsqb;&lsqb; -n ${DIRCHK} &rsqb;&rsqb;
#GVM#      then
#GVM#        # BUILDDIR and DATAPATH include leading '/'
#GVM#        if (( DRYRUN ))
#GVM#          then
#GVM#            print_msg "\ncp -puvr //${SRCSVR}${BUILDDIR}/* //${SVR}${DATAPATH}" "dryrun"
#GVM#          else
#GVM#            cp -puvr //${SRCSVR}${BUILDDIR}/* //${SVR}${DATAPATH}
#GVM#            let CPRESULT=$?
#GVM#        fi
#GVM#      else
#GVM#        ERRORDESC="ERROR 111: Could not copy patch ${PATCHVER} files from \
#GVM#${SRCSVR}:${BUILDDIR} to ${SVR}"
#GVM#
#GVM#        let ERROR_CODE=111
#GVM#        critical_error
#GVM#    fi
fi

print_msg "CPRESULT=${CPRESULT}" "debug"

# Verify copy success
if &lsqb;&lsqb; ${CPRESULT} != 0 &rsqb;&rsqb;
  then
    ERRORDESC="ERROR 112: Failed to copy source files to ${SVR}"
    let ERROR_CODE=112
    critical_error
  else
#GVM#    unpack_files ${SVR}
    unpack_files ${SVR} "${FILE}"
fi

print_msg "\n(${MM}/${DD} $(date +%R)) End copy_files" "debug"
}
################################################################################
# unpack_files
################################################################################
unpack_files()
{
print_msg "\n(${MM}/${DD} $(date +%R)) Started unpack_files" "debug"

unset ACTIONFILE BESDATAPATH CPPACTIONFILE CPRESULT OGNACTIONFILE RESULT RPMFILES
unset SPATH TGT TFILE UNPACK

local ACTIONFILE=""
local BESDATAPATH='//${TGT}${DATAPATH}/BESClient'
local CPPACTIONFILE=""
local CPRESULT=0
local OGNACTIONFILE=""
local RESULT=99
local RPMFILES=0
local SPATH="//${SOURCESVR}${HABES}"
local TGT="${1}"
#GVM#local TFILE=""
local TFILE="${2}"
local UNPACK=""

# Check for tarball on target server
# (e) Perform parameter expansion, command substitution and arithmetic
#     expansion on the result.
#GVM#TFILE="$( ls //${TGT}${DATAPATH} 2&gt;/dev/null | grep -iE "${(e)SOURCEFILES}$" | \
#GVM#grep -i "${MQVERBASE}${PATCHVER}" )"
if &lsqb;&lsqb; ${#TFILE} == 0 &rsqb;&rsqb;
  then
    TFILE="$( ls //${TGT}${DATAPATH} 2&gt;/dev/null | grep -iE "${(e)SOURCEFILES}$" \
| sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' )"

fi

print_msg "BESDATAPATH=${(e)BESDATAPATH}~nDATAPATH=${DATAPATH}~nSPATH=${SPATH}~nTGT=${TGT}~n\
TFILE=${TFILE}" "debug"

if &lsqb;&lsqb; -n ${TFILE} &rsqb;&rsqb;
  then
    # DATAPATH includes leading '/'
    if (( DRYRUN ))
      then
        print_msg "\nnexec -i -l ${TGT} \"${TAR} -C ${DATAPATH} -zxf ${DATAPATH}/${TFILE} \
; echo -e \\\"RESULT=\\\$?\\\"\"" "dryrun"

        let RESULT=0
      else
        UNPACK="$( nexec -i -l ${TGT} "${TAR} -C ${DATAPATH} -zxf ${DATAPATH}/${TFILE} \
; echo -e \"RESULT=\$?\"" )"

        let RESULT=$( echo -e "${UNPACK}" | grep "RESULT=" | \
sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' | cut -f2 -d'=' )

        print_msg "UNPACK=${UNPACK}~nRESULT=${RESULT}" "debug"
    fi
    if &lsqb;&lsqb; ${RESULT:=99} != 0 &rsqb;&rsqb;
      then
        ERRORDESC="ERROR 113: Failed to unpack ${TFILE} on ${TGT}"
        let ERROR_CODE=113
        if &lsqb;&lsqb; -n "${UNPACK}" &rsqb;&rsqb; ; then print_msg "UNPACK=\n${UNPACK}" ; fi
        critical_error
      else
        # Force owner:group mqm:mqm for new installs
        if (( NEWINST ))
          then
            if (( DRYRUN ))
              then
                print_msg "\nnexec -i -l ${TGT} \"${FINDCMD} ${DATAPATH} \
${FINDARGS}\"" "dryrun"

              else
                nexec -i -l ${TGT} "${FINDCMD} ${DATAPATH} ${FINDARGS}"
            fi
        fi
    fi
  else
    if (( ! DRYRUN ))
      then
        ERRORDESC="ERROR 126: tar archive not found in ${DATAPATH} on ${TGT}"
        let ERROR_CODE=126
        critical_error
    fi
fi

# If BESAgent is not installed, ensure install files are available
if &lsqb;&lsqb; ${BESINSTALL} == 1 &rsqb;&rsqb;
  then
    # Validate existence of actionsite.afxm and BESAgent RPM files
    BESFILES="$( find ${(e)BESDATAPATH} -type f -exec ls {} \; 2&gt;/dev/null )"
    ACTIONFILE="$( echo -e "${BESFILES}" | grep -ic "/corp/${BESACTION}" )"
    CPPACTIONFILE="$( echo -e "${BESFILES}" | grep -ic "mn/${BESACTION}" )"
    OGNACTIONFILE="$( echo -e "${BESFILES}" | grep -ic "og/${BESACTION}" )"
    RPMFILES="$( echo -e "${BESFILES}" | grep -icE "${BESAGENTBASE}.*[.]rpm" )"
    print_msg "\nBESFILES=\n$( echo -e "${BESFILES}" | sed 's/\(^.*$\)/\\t \1/g' )\
~nACTIONFILE=${ACTIONFILE}~nCPPACTIONFILE=${CPPACTIONFILE}~nOGNACTIONFILE=\
${OGNACTIONFILE}~nRPMFILES=${RPMFILES}" "debug"

    # If any files are missing, retrieve from SOURCESVR
    if &lsqb;&lsqb; ${RPMFILES} != 2 || ${ACTIONFILE} == 0 || ${CPPACTIONFILE} == 0 || \
${OGNACTIONFILE} == 0 &rsqb;&rsqb;

      then
        # Retrieve BESAgent RPM file if not found
        if &lsqb;&lsqb; ${RPMFILES} != 2 &rsqb;&rsqb;
          then
            if (( ! DRYRUN ))
              then
#GVM#                print_msg "\ncp -puv ${SPATH}/*.rpm ${(e)BESDATAPATH}/" "dryrun"
#GVM#              else
#GVM#                if &lsqb;&lsqb; ! -d ${(e)BESDATAPATH} &rsqb;&rsqb;
#GVM#                  then
#GVM#                    if (( DRYRUN ))
#GVM#                      then
#GVM#                        print_msg "nexec -i -l ${TGT} sh -c \"mkdir -p ${DATAPATH}/BESClient ; \
#GVM#chown mqm:mqm ${DATAPATH}/BESClient\""
#GVM#
#GVM#                      else
#GVM#                        nexec -i -l ${TGT} sh -c "mkdir -p ${DATAPATH}/BESClient ; \
#GVM#chown mqm:mqm ${DATAPATH}/BESClient"
#GVM#
#GVM#                    fi
#GVM#                fi
#GVM#                cp -puv ${SPATH}/*.rpm ${(e)BESDATAPATH}/
#GVM#                if &lsqb;&lsqb; $? != 0 &rsqb;&rsqb;
#GVM#                  then
#GVM#                    ERRORDESC="ERROR 114: Failed to copy BES Agent RPMs from \
#GVM#${SOURCESVR} to ${TGT}"
                    ERRORDESC="ERROR 114: BES Agent RPMs not found on ${TGT}"
                    let ERROR_CODE=114
                    critical_error
#GVM#                fi
#GVM#            fi
        fi
        if (( ! PTC ))
          then
#GVM#            # Retrieve actionsite.afxm file if not found
            if &lsqb;&lsqb; ${ACTIONFILE} == 0 &rsqb;&rsqb;
              then
                if (( ! DRYRUN ))
                  then
#GVM#                    print_msg "\ncp -puv ${SPATH}/corp/${BESACTION} \
#GVM#${(e)BESDATAPATH}/corp/" "dryrun"
#GVM#
#GVM#                  else
#GVM#                    if &lsqb;&lsqb; ! -d ${(e)BESDATAPATH}/corp &rsqb;&rsqb;
#GVM#                      then
#GVM#                        if (( DRYRUN ))
#GVM#                          then
#GVM#                            print_msg "nexec -i -l ${TGT} sh -c \"mkdir -p ${DATAPATH}/BESClient/corp ; \
#GVM#chown mqm:mqm ${DATAPATH}/BESClient/corp\""
#GVM#
#GVM#                          else
#GVM#                            nexec -i -l ${TGT} sh -c "mkdir -p ${DATAPATH}/BESClient/corp ; \
#GVM#chown mqm:mqm ${DATAPATH}/BESClient/corp"
#GVM#
#GVM#                        fi
#GVM#                    fi
#GVM#                    cp -puv ${SPATH}/corp/${BESACTION} ${(e)BESDATAPATH}/corp/
#GVM#                    if &lsqb;&lsqb; $? != 0 &rsqb;&rsqb;
#GVM#                      then
#GVM#                        ERRORDESC="ERROR 115: Failed to copy Corporate ${BESACTION} file \
#GVM#from ${SOURCESVR} to ${TGT}"
                        ERRORDESC="ERROR 115: Corporate ${BESACTION} file not found on ${TGT}"
                        let ERROR_CODE=115
                        critical_error
#GVM#                    fi
#GVM#                fi
            fi
          else
#GVM#            # Retrieve mn/actionsite.afxm file if not found
            if &lsqb;&lsqb; ${CPPACTIONFILE} == 0 &rsqb;&rsqb;
              then
                if (( ! DRYRUN ))
                  then
#GVM#                    print_msg "\ncp -puv ${SPATH}/mn/${BESACTION} \
#GVM#${(e)BESDATAPATH}/mn/" "dryrun"
#GVM#
#GVM#                  else
#GVM#                    if &lsqb;&lsqb; ! -d ${(e)BESDATAPATH}/mn &rsqb;&rsqb;
#GVM#                      then
#GVM#                        if (( DRYRUN ))
#GVM#                          then
#GVM#                            print_msg "nexec -i -l ${TGT} sh -c \"mkdir -p ${DATAPATH}/BESClient/mn ; \
#GVM#chown mqm:mqm ${DATAPATH}/BESClient/mn\""
#GVM#
#GVM#                          else
#GVM#                            nexec -i -l ${TGT} sh -c "mkdir -p ${DATAPATH}/BESClient/mn ; \
#GVM#chown mqm:mqm ${DATAPATH}/BESClient/mn"
#GVM#
#GVM#                        fi
#GVM#                    fi
#GVM#                    cp -puv ${SPATH}/mn/${BESACTION} ${(e)BESDATAPATH}/mn/
#GVM#                    if &lsqb;&lsqb; $? != 0 &rsqb;&rsqb;
#GVM#                      then
#GVM#                        ERRORDESC="ERROR 127: Failed to copy PTC CPP ${BESACTION} \
#GVM#file from ${SOURCESVR} to ${TGT}"
                        ERRORDESC="ERROR 127: PTC CPP ${BESACTION} file not found on ${TGT}"
                        let ERROR_CODE=127
                        critical_error
#GVM#                    fi
#GVM#                fi
            fi
#GVM#            # Retrieve og/actionsite.afxm file if not found
            if &lsqb;&lsqb; ${OGNACTIONFILE} == 0 &rsqb;&rsqb;
              then
                if (( ! DRYRUN ))
                  then
#GVM#                    print_msg "\ncp -puv ${SPATH}/og/${BESACTION} \
#GVM#${(e)BESDATAPATH}/og/" "dryrun"
#GVM#
#GVM#                  else
#GVM#                    if &lsqb;&lsqb; ! -d ${(e)BESDATAPATH}/og &rsqb;&rsqb;
#GVM#                      then
#GVM#                        if (( DRYRUN ))
#GVM#                          then
#GVM#                            print_msg "nexec -i -l ${TGT} sh -c \"mkdir -p ${DATAPATH}/BESClient/og ; \
#GVM#chown mqm:mqm ${DATAPATH}/BESClient/og\""
#GVM#
#GVM#                          else
#GVM#                            nexec -i -l ${TGT} sh -c "mkdir -p ${DATAPATH}/BESClient/og ; \
#GVM#chown mqm:mqm ${DATAPATH}/BESClient/og"
#GVM#
#GVM#                        fi
#GVM#                    fi
#GVM#                    cp -puv ${SPATH}/og/${BESACTION} ${(e)BESDATAPATH}/og/
#GVM#                    if &lsqb;&lsqb; $? != 0 &rsqb;&rsqb;
#GVM#                      then
#GVM#                        ERRORDESC="ERROR 128: Failed to copy PTC OGN ${BESACTION} \
#GVM#file from ${SOURCESVR} to ${TGT}"
                        ERRORDESC="ERROR 128: PTC OGN ${BESACTION} file not found on ${TGT}"
                        let ERROR_CODE=128
                        critical_error
#GVM#                    fi
#GVM#                fi
            fi
        fi
    fi
fi

print_msg "\n(${MM}/${DD} $(date +%R)) End unpack_files" "debug"
}
################################################################################
# install_bes
################################################################################
install_bes()
{
print_msg "\n(${MM}/${DD} $(date +%R)) Started install_bes" "debug"

unset BESINSTCMDS BESINSTOUT COPYBESCMD CPBES CPRESULT RESULT STARTBES TARGET

local BESINSTCMDS=""
local BESINSTOUT=""
local COPYBESCMD=""
local CPBES=""
local CPRESULT=99
local RESULT=99
local STARTBES=""
local TARGET="${1}"

BESINSTCMDS="mkdir -p \"${BESCLIENTPATH}\" &amp;&amp; chmod u+rwx,g+rx,o+rx \"${BESCLIENTPATH}\""
BESINSTCMDS+=" ; ${RPM_CMD} -i ${DATAPATH}/BESClient/${BESAGENTRPM} 2&gt;&amp;1 | "
BESINSTCMDS+="tee /tmp/besinstall.log ; echo -e \"RESULT=\$?\""

print_msg "BESINSTCMDS=${BESINSTCMDS}~nTARGET=${TARGET}" "debug"

if (( DRYRUN ))
  then
    print_msg "\nnexec -i -l ${TARGET} \"${BESINSTCMDS}\"" "dryrun"
  else
    if &lsqb;&lsqb; ${ROLLBACK} == 1 || ${PATCHVER} == ${VER} &rsqb;&rsqb;
      then
        unpack_files ${TARGET}
    fi
    BESINSTOUT="$( nexec -i -l ${TARGET} "${BESINSTCMDS}" )"
    BESINSTOUT="$( echo -e "${BESINSTOUT}" | sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' )"
    let RESULT="$( echo -e "${BESINSTOUT}" | grep "RESULT=" | \
sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' | cut -f2 -d'=' )"

    print_msg "\nBESINSTOUT=\n${BESINSTOUT}~nRESULT=${RESULT}" "debug"
fi

if &lsqb;&lsqb; ${RESULT:=99} != 0 &rsqb;&rsqb;
  then
    ERRORDESC="ERROR 108: Failed to install ${BESAGENTRPM} on ${TARGET}"
    let ERROR_CODE=108
    if &lsqb;&lsqb; -n "${BESINSTOUT}" &rsqb;&rsqb; ; then print_msg "BESINSTOUT=\n${BESINSTOUT}" ; fi
    critical_error
  else
    # Copy actionsite.afxm file to /etc/opt/BEClient on TARGET
    if (( ! PTC ))
      then
        COPYBESCMD="cp ${DATAPATH}/BESClient/corp/${BESACTION} ${BESCLIENTPATH} 2&gt;&amp;1 &amp;&amp; "
      elif (( CPP ))
        then
          COPYBESCMD="cp ${DATAPATH}/BESClient/mn/${BESACTION} ${BESCLIENTPATH} 2&gt;&amp;1 &amp;&amp; "
        elif (( OGDEN ))
          then
            COPYBESCMD="cp ${DATAPATH}/BESClient/og/${BESACTION} ${BESCLIENTPATH} 2&gt;&amp;1 &amp;&amp; "
    fi
    COPYBESCMD+="echo -e \"RESULT=\$?\" ; chmod u+rw,g-rwx,o-rwx ${BESCLIENTPATH}/${BESACTION}"
    print_msg "\nCOPYBESCMD=${COPYBESCMD}" "debug"
    if (( DRYRUN ))
      then
        print_msg "\nnexec -i -l ${TARGET} \"${COPYBESCMD}\"" "dryrun"
      else
        CPBES="$( nexec -i -l ${TARGET} "${COPYBESCMD}" )"
        let CPRESULT="$( echo -e "${CPBES}" | grep "RESULT=" | \
sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' | cut -f2 -d'=' )"

        print_msg "CPBES=${CPBES}~nCPRESULT=${CPRESULT}" "debug"
        if &lsqb;&lsqb; ${CPRESULT:=99} != 0 &rsqb;&rsqb;
          then
            ERRORDESC="ERROR 109: Failed to copy ${BESACTION} to ${BESCLIENTPATH} \
on ${TARGET}"

            let ERROR_CODE=109
            if &lsqb;&lsqb; -n "${CPBES}" &rsqb;&rsqb; ; then print_msg "CPBES=\n${CPBES}" ; fi
            critical_error
        fi
    fi
    print_msg "STARTBESCMD=${STARTBESCMD}" "debug"
    if (( DRYRUN ))
      then
        print_msg "\nnexec -i -l ${TARGET} \"${STARTBESCMD}\"" "dryrun"
      else
        STARTBES="$( nexec -i -l ${TARGET} "${STARTBESCMD}" )"
        STARTBES="$( echo -e "${STARTBES}" | sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' )"
        print_msg "STARTBES=${STARTBES}" "debug"
        let BESSTATUS="$( echo -e "${STARTBES}" | grep -i "besclient" | \
sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' | grep -ic "running" )"

        if &lsqb;&lsqb; ${BESSTATUS:=0} == 0 &rsqb;&rsqb;
          then
            ERRORDESC="ERROR 110: Failed to start BESClient on ${TARGET}"
            let ERROR_CODE=110
            if &lsqb;&lsqb; -n "${STARTBES}" &rsqb;&rsqb; ; then print_msg "STARTBES=\n${STARTBES}\n\
BESSTATUS=${BESSTATUS}" ; fi

            critical_error
        fi
    fi
fi

print_msg "\n(${MM}/${DD} $(date +%R)) End install_bes" "debug"
}
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/86952</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/86952</guid><dc:creator><![CDATA[greg-michael]]></dc:creator><pubDate>Fri, 09 Jun 2023 20:29:56 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Fri, 09 Jun 2023 20:27:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a> Part 2</p>
<pre><code>################################################################################
# env_check
################################################################################
env_check()
{
print_msg "\n(${MM}/${DD} $(date +%R)) Started env_check" "debug"

unset APPPATHOUT BESAGENTRPM BESCHKOUT CHKCMDS DATAPATHOUT EXISTING GRPID INSTCNT
#GVM#unset INSTPATH IPADDR LICCHK MAJVER MAXCMDLVL MKPATH MKPATHOUT MQCVPATHOUT MQRPMS
unset INSTPATH IPADDR LICCHK MAJVER MAXCMDLVL MKPATH MKPATHOUT MQCVPATHOUT _MQRPMS
unset MQVERSION NEWINST OPTDIR OPTPATHOUT OSNAME PATHCHK RPMCHKOUT RPMSVRCHKOUT
unset SVR TAGCNT USERID VER

local APPPATHOUT=""
local BESCHKOUT=""
local CHKCMDS=""
local DATAPATHOUT=""
local GRPID=0
local INSTCNT=0
local MKPATH=""
local MKPATHOUT=""
local MQCVPATHOUT=""
#GVM#local MQRPMS=""
local OPTPATHOUT=0
local OSNAME=""
local PATHCHK=""
local RPMSVRCHKOUT=0
local TAGCNT=0
local SVR="${1}"
local USERID=0

export BESAGENTRPM="${BESAGENTBASE}"
export CPP=0
export _MQRPMS=""
export MQVERSION=""
export OGDEN=0
export OPTDIR=0
export PTC=0
export RPMCHKOUT=0
export RPMMQBASECNT=0

#GVM#if (( NEWMQVERBASE ))
#GVM#  then
#GVM#    export NEWMQVERBASE=0
#GVM#    export MQVERBASE='9.2.0-'
#GVM#    print_msg "NEWMQVERBASE=${NEWMQVERBASE}~nMQVERBASE=${MQVERBASE}" "debug"
#GVM#fi

PATHCHK='${FINDCMD} /{usr,var,opt} -mindepth 1 -maxdepth 2 -type d \( -iname "mqm" -o '
PATHCHK+='-iname "mqcv" \) -exec ls -ld {} \; 2&gt;/dev/null'
print_msg "BESAGENTRPM=${BESAGENTRPM}~nPATHCHK=${(e)PATHCHK}~nSVR=${SVR}" "debug"

# (e) Perform parameter expansion, command substitution and arithmetic expansion on the result.
CHKCMDS="$( nexec -ncq -i -l ${SVR} sh -c "${(e)PATHCHK} ; ${RPMCHK} ; ${(e)TAGCHK} ; \
let USERID=\$( ${GETENT} passwd mqm | ${GREPNC} -c \"mqm\" ) ; \
let GRPID=\$( ${GETENT} group mqm | ${GREPNC} -c \"mqm\" ) ; \
IPADDR=\$( ${GREPNC} -iE \"${SVR%%.*}[. $]\" /etc/hosts | ${GREPNC} -v '::1' ) ; \
REL=\"\$( ls /etc/*-release | ${GREPNC} -iE \"(suse|redhat)\" | sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' )\" ; \
echo -e \"USERID=\${USERID}\\nGRPID=\${GRPID}\\nIPADDR=\${IPADDR}\\nREL=\${REL##*/}\"" )"

print_msg "\nCHKCMDS=\n$( echo -e "${CHKCMDS}" | sed 's/\(^.*$\)/\\t\1/g' )" "debug"

# Check for mqm user account and mqm group
let GRPID=$( echo -e "${CHKCMDS}" | grep "GRPID=" | sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' | cut -f2 -d'=' )
let USERID=$( echo -e "${CHKCMDS}" | grep "USERID=" | sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' | cut -f2 -d'=' )
print_msg "USERID=${USERID}~nGRPID=${GRPID}" "debug"

if ! (( ${GRPID} &amp;&amp; ${USERID} ))
  then
    if (( ! ${USERID} ))
      then
        ERRORDESC="ERROR 104: User mqm is not present on ${SVR}."
        let ERROR_CODE=104
    fi
    if (( ! ${GRPID} ))
      then
        ERRORDESC="ERROR 105: Group mqm not present on ${SVR}."
        let ERROR_CODE=105
    fi
    critical_error
fi

# Parse output of CHKCMDS for use below.
# (e) Perform parameter expansion, command substitution and arithmetic
#     expansion on the result.
APPPATHOUT="$( echo -e "${CHKCMDS}" | grep -icE "${APPPATH}$" )"
BESCHKOUT="$( echo -e "${CHKCMDS}" | grep -icE "${(e)BESAGENTRPM}.*" )"
DATAPATHOUT="$( echo -e "${CHKCMDS}" | grep -icE "${DATAPATH}$" )"
MQCVPATHOUT="$( echo -e "${CHKCMDS}" | grep -icE "(${MQCVPATH}|/opt/mqm)$" )"
#GVM#MQRPMS="$( echo -e "${CHKCMDS}" | grep -iE "[.]x86(_64)?" )"
_MQRPMS="$( echo -e "${CHKCMDS}" | grep -iE "[.]x86(_64)?" | \
sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' )"

# Determine OS for correct RPM for BES Agent
export SVROS="$( echo -e "${CHKCMDS}" | grep "REL=" | \
sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' | cut -f2 -d'=' | cut -f1 -d'-' )"

if &lsqb;&lsqb; -z ${SVROS} &rsqb;&rsqb;
  then
    ERRORDESC="ERROR 139: Failed to determine OS for ${SVR}"
    let ERROR_CODE=139
    critical_error
  else
    print_msg "SVROS=${SVROS}" "debug"
fi

# Extract IP Address for PTC executions
export IPADDR="$( echo -e "${CHKCMDS}" | grep "IPADDR=" | cut -f2 -d'=' | awk '{print $1}' )"
if &lsqb;&lsqb; -z ${IPADDR} &rsqb;&rsqb;
  then
    ERRORDESC="ERROR 134: IP Address not found in /etc/hosts on ${SVR}"
    let ERROR_CODE=134
    critical_error
  else
    print_msg "IPADDR=${IPADDR}" "debug"
fi

if &lsqb;&lsqb; $( echo -e "${IPADDR}" | grep -c '10.241.' ) == 1 &rsqb;&rsqb;
  then
    export PTC=1
    if &lsqb;&lsqb; $( echo -e "${IPADDR}" | grep -c '10.241.1' ) == 1 &rsqb;&rsqb;
      then
        export OGDEN=1
    fi
    if &lsqb;&lsqb; $( echo -e "${IPADDR}" | grep -c '10.241.2' ) == 1 &rsqb;&rsqb;
      then
        export CPP=1
    fi
    OPTPATHOUT="$( echo -e "${CHKCMDS}" | grep -icE "/opt/mqm$" )"
    if (( OPTPATHOUT )) ; then let OPTDIR=1 ; export OPTDIR ; fi
    print_msg "PTC=${PTC}~nOGDEN=${OGDEN}~nCPP=${CPP}~nOPTDIR=${OPTDIR}\
~nOPTPATHOUT=${OPTPATHOUT}" "debug"

fi

export RPMCHKOUT="$( echo -e "${CHKCMDS}" | grep -iv "${MQSERVERRPM}" | \
sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' | grep -ic "${RPMBASE}" )"

#GVM#export RPMMQBASECNT="$( echo -e "${CHKCMDS}" | grep -iv "${MQSERVERRPM}" \
#GVM#| grep -icE "${RPMBASE}.*-${MQVERBASE}${MQVERBASEMIN}" )"
export RPMMQBASECNT="$( echo -e "${CHKCMDS}" | grep -iv "${MQSERVERRPM}" | \
sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' | grep -icE "${RPMBASE}.*-${MQVERBASEERE}${MQVERBASEMIN}" )"

RPMSVRCHKOUT="$( echo -e "${CHKCMDS}" | grep -ic "${MQSERVERRPM}" )"
TAGCNT="$( echo -e "${CHKCMDS}" | grep -icE '.*tag' )"
print_msg "APPPATHOUT=${APPPATHOUT}~nBESCHKOUT=${BESCHKOUT}~nDATAPATHOUT=\
${DATAPATHOUT}~nMQCVPATHOUT=${MQCVPATHOUT}~nRPMCHKOUT=${RPMCHKOUT}\
~nRPMMQBASECNT=${RPMMQBASECNT}~nRPMSVRCHKOUT=${RPMSVRCHKOUT}~nTAGCNT=${TAGCNT}" "debug"

# Validate that MQ Server RPMs are not installed
# Abort now if this server has MQSeriesServer installed
if &lsqb;&lsqb; ${RPMSVRCHKOUT} != 0 &rsqb;&rsqb;
  then
    ERRORDESC="ERROR 106: MQ Server RPMs installed on ${SVR}"
    let ERROR_CODE=106
    critical_error
fi

# If MQ Client RPMs are not installed, install as new
if &lsqb;&lsqb; ${RPMCHKOUT} == 0 &rsqb;&rsqb;
  then
    if &lsqb;&lsqb; ${UNINSTALL} == 0 &amp;&amp; ${ROLLBACK} == 0 &rsqb;&rsqb;
      then
        print_msg "MQ Client RPMs not installed on ${SVR} - Initiating New Install"
        export NEWINST=1
        export EXISTING=0
        INSTPATH="${MQCVPATH}"
        # Validate /usr/mqm and /usr/mqm/MQCV exist. Create them and set correct
        # ownership and permissions if not found.
        if &lsqb;&lsqb; ${APPPATHOUT} == 0 &rsqb;&rsqb;
          then
            MKPATH="mkdir -p \"${MQCVPATH}\" &amp;&amp; chown -R mqm \"${APPPATH}\""
            MKPATH+=" ; chgrp -R mqm \"${APPPATH}\""
            MKPATH+=" ; chmod -R u+rwx,g+rx,o+rx \"${APPPATH}\""
            print_msg "MKPATH=${MKPATH}" "debug"
          elif &lsqb;&lsqb; ${MQCVPATHOUT} == 0 &rsqb;&rsqb;
            then
              MKPATH="mkdir -p \"${MQCVPATH}\" &amp;&amp; chown -R mqm:mqm \"${APPPATH}\""
              MKPATH+=" ; chgrp -R mqm \"${APPPATH}\""
              MKPATH+=" ; chmod -R u+rwx,g+rx,o+rx \"${APPPATH}\""
              print_msg "MKPATH=${MKPATH}" "debug"
        fi
    fi
  else
    if (( OPTDIR ))
      then
        MQCHK="$( nexec -i -l ${SVR} "/opt/mqm${DSPMQVER}" )"
        export INSTPATH="/opt/mqm"
        export EXISTING=1
        export NEWINST=0
      else
        MQCHK="$( nexec -i -l ${SVR} "${MQCVPATH}${DSPMQVER}" )"
    fi
    # Check for multiple installations of MQ Client
    let INSTCNT=$( echo -e "${MQCHK}" | sed -e 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' | \
grep -iE "^(Version|InstPath|InstName|Primary):" | \
sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' | wc -l | sed -e 's/&lsqb;&lsqb;:space:&rsqb;&rsqb;*//g' )

    print_msg "\nMQCHK=\n${MQCHK}~nINSTCNT=${INSTCNT}" "debug"
    if &lsqb;&lsqb; ${INSTCNT} != 4 &rsqb;&rsqb;
      then
        ERRORDESC="ERROR 136: Multiple installations of MQ Client detected in /etc/opt/mqm/mqinst.ini \
on ${SVR}"

        let ERROR_CODE=136
        if &lsqb;&lsqb; -n ${MQCHK} &rsqb;&rsqb; ; then print_msg "MQCHK=\n${MQCHK}" ; fi
        critical_error
    fi
    # Check for existing MQ Client path
    if &lsqb;&lsqb; ${MQCVPATHOUT} == 1 &rsqb;&rsqb;
      then
        export EXISTING=1
        export NEWINST=0
        MQCHK="$( echo -e "${MQCHK}" | sed 's/&lsqb;&lsqb;:cntrl:&rsqb;&rsqb;*//g' )"
        # Determine Install Path
        export INSTPATH="$( echo -e "${MQCHK}" | \
awk -F': ' '$0 ~ /^InstPath:/ {print $2}' | sed 's/^[ ]*//g' )"

        # Determine Major Version
        export MAJVER="$( echo -e "${MQCHK}" | \
awk -F': ' '$0 ~ /^Version:/ { sub(/[ ]*/,"",$2) ; print substr($2,1,1) }' )"

        # Grab MaxCmdLvl from dspmqver output
        export MAXCMDLVL="$( echo -e "${MQCHK}" | \
awk -F': ' '$0 ~ /^MaxCmdLevel:/ { sub(/[ ]*/,"",$2) ; print $2 }' )"

        # Update MQVERBASE if MaxCmdLevel is greater than current Base level
        if &lsqb;&lsqb; ${MAXCMDLVL} &gt; ${BASECMDLVL} &rsqb;&rsqb;
          then
            export MQVERBASE="$( echo -e "${MQCHK}" | \
awk -F': ' '$0 ~ /^Version:/ { sub(/[ ]*/,"",$2) ; print substr($2,1,5)"-" }' )"

            print_msg "New MQVERBASE\nMQVERBASE=${MQVERBASE}" "debug"
        fi
        # Extract currently installed version from dspmqver output
        export MQVERSION="$( echo -e "${MQCHK}" | \
awk -F': ' '$0 ~ /^Version:/ { sub(/[ ]*/,"",$2) ; print substr($2,1,5) "-" substr($2,7,1) }' )"

        # Grab the Fix Pack part of the version (last number(s) after the final period)
        # i.e. - 8.0.0.15, 9.2.0.4
        # match looks for the last characters starting from the period until
        # the end of the line that do NOT include a period, and then add 1
        # to the value for the substring command
        export VER="$( echo -e "${MQCHK}" | \
awk -F': ' '$0 ~ /^Version:/ {print substr($2,match($2,/[.][^.]*$/)+1,1)}' )"

        if &lsqb;&lsqb; ${MAJVER} != 9 &rsqb;&rsqb;
          then
            print_msg "MQ Client version ${MAJVER} found - manual removal required."
            ERRORDESC="ERROR 135: MQ Client version ${MAJVER} found - manual removal required."
            let ERROR_CODE=135
            critical_error
        fi
        export LICCHK="$( echo -e "${MQCHK}" | \
awk -F': ' '$0 ~ /^LicenseType:/ {print $2}' )"

        if (( EXISTING ))
          then
            print_msg "MQ Client ${MQVERSION} found installed at ${INSTPATH} on ${SVR}"
            #GVM#print_msg "RPM versions installed:\n${MQRPMS}"
            print_msg "RPM versions installed:\n${_MQRPMS}"
#GVM#        print_msg "MAJVER=${MAJVER}~nVER=${VER}~nLICCHK=${LICCHK}" "debug"
        print_msg "MAJVER=${MAJVER}~nMAXCMDLVL=${MAXCMDLVL}~nVER=${VER}~nLICCHK=${LICCHK}\
~nMQVERSION=${MQVERSION}" "debug"

        fi
      elif &lsqb;&lsqb; ${OPTDIR} == 0 &rsqb;&rsqb;
        then
          ERRORDESC="ERROR 130: Unable to determine install state on ${SVR}"
          let ERROR_CODE=130
          critical_error
    fi
fi
print_msg "INSTPATH=${INSTPATH}~nEXISTING=${EXISTING}~nNEWINST=${NEWINST}" "debug"

# Validate /var/mqm exists. Create it and set correct ownership and permissions
# if not found.
if &lsqb;&lsqb; ${DATAPATHOUT} == 0 &amp;&amp; ${NEWINST} == 1 &rsqb;&rsqb;
  then
    if &lsqb;&lsqb; -n ${MKPATH} &rsqb;&rsqb;
      then
        MKPATH+=" ; mkdir -p \"${DATAPATH}\" &amp;&amp; chown mqm \"${DATAPATH}\""
        MKPATH+=" ; chgrp mqm \"${DATAPATH}\" ; chmod u+rwx,g+rwxs,o+rx \"${DATAPATH}\" "
      else
        MKPATH="mkdir -p \"${DATAPATH}\" &amp;&amp; chown mqm \"${DATAPATH}\" ; "
        MKPATH+="chgrp mqm \"${DATAPATH}\" ; chmod u+rwx,g+rx,o+rx \"${DATAPATH}\" "
    fi
    print_msg "MKPATH=${MKPATH}" "debug"
fi

# If one or more paths do not exist, create it/them.
if &lsqb;&lsqb; -n ${MKPATH} &rsqb;&rsqb;
  then
    if (( DRYRUN ))
      then
        print_msg "\nnexec -i -l ${SVR} \"${MKPATH}\"" "dryrun"
      else
        nexec -i -l ${SVR} "${MKPATH}"
        if &lsqb;&lsqb; $? != 0 &rsqb;&rsqb;
          then
            ERRORDESC="ERROR 107: Error encountered while creating paths on ${SVR}"
            let ERROR_CODE=107
            critical_error
        fi
    fi
fi

# Check BESClient installation
if &lsqb;&lsqb; ${BESCHKOUT} == 0 &rsqb;&rsqb;
  then
    if &lsqb;&lsqb; ${UNINSTALL} == 0 &amp;&amp; ${ROLLBACK} == 0 &rsqb;&rsqb;
      then
        print_msg "BES Agent missing on ${SVR} - installing"
        export BESINSTALL=1
#GVM#        # Determine OS for correct RPM for BES Agent
#GVM#        export SVROS="$( echo -e "${CHKCMDS}" | grep "REL=" | cut -f2 -d'=' | cut -f1 -d'-' )"
        if [ "x${(L)SVROS}" = "xsuse" ]
          then
            export BESAGENTRPM="${BESAGENTBASE}*-sle*${RPMPLATFORM}${RPMSUFFIX}"
          elif [ "x${(L)SVROS}" = "xredhat" ]
            then
              export BESAGENTRPM="${BESAGENTBASE}*-rhe*${RPMPLATFORM}${RPMSUFFIX}"
            else
              ERRORDESC="ERROR 129: Unable to determine OS of ${SVR}"
              let ERROR_CODE=129
              critical_error
        fi
        print_msg "BESAGENTRPM=${BESAGENTRPM}" "debug"
      else
        export BESINSTALL=0
    fi
    print_msg "BESINSTALL=${BESINSTALL}" "debug"
fi

# Check for existence of .*tag files - remove if found
#GVM#if (( TAGCNT ))
#GVM#  then
#GVM#    if (( DRYRUN ))
#GVM#      then
#GVM#        # (e) Perform parameter expansion, command substitution and arithmetic
#GVM#        # expansion on the result.
#GVM#        print_msg "\nnexec -i -l ${SVR} \"${(e)TAGRM}\"" "dryrun"
#GVM#      else
#GVM#        nexec -i -l ${SVR} "${(e)TAGRM}"
#GVM#        if &lsqb;&lsqb; $? != 0 &rsqb;&rsqb;
#GVM#          then
#GVM#            ERRORDESC="ERROR 123: Failed to remove .*tag file(s) on ${SVR}."
#GVM#            let ERROR_CODE=123
#GVM#            critical_error
#GVM#        fi
#GVM#    fi
#GVM#fi

print_msg "\n(${MM}/${DD} $(date +%R)) End env_check" "debug"
}
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/86950</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/86950</guid><dc:creator><![CDATA[greg-michael]]></dc:creator><pubDate>Fri, 09 Jun 2023 20:27:41 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Fri, 09 Jun 2023 20:25:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a> Here you go…</p>
<pre><code>#!/bin/nsh
# set -x
#GVM## Version: 2022.03.01
# Version: 2023.06.09
################################################################################
#############                 MQ_client_util.nsh                   #############
################################################################################
# Author:       Greg Michael
# Date Created: 2021-08-27
# Description:  This script is intended to be run from TSSA.
#               This script facilitates the installation, upgrade, downgrade, or
#               removal of the MQ Client on a server. It also checks for and if
#               necessary installs the BES Agent used for license auditing.
#
# Inputs:
# ${NSH}.nsh -s "&lt;host&gt; [&lt;host2&gt; &lt;hostN&gt; ...]" [-d] [-h] [-p &lt;#&gt;] [-R|-U] [-y]
#        options enclosed in square brackets () are optional
#         -d              Enable DEBUG output (optional, noisy)
#         -h              Help - display this usage message
#         -p # (3)        Patch Number
#                          (3) optional for upgrades - will select
#                              highest version available
#         -R   (1)        ROLLBACK - uninstall latest FP from target
#                          (1) cannot be run with Uninstall option (-U)
#         -s "&lt;list&gt;"     Hosts, enclosed in quotes, space separated (required)
#         -U   (1)        Uninstall MQ Client (optional)
#                          (1) cannot be run with Rollback option (-R)
#         -y              DRYRUN - execute DRYRUN (optional)
#
#
# Notes:
#        Script can be run against multiple servers, but runs one at a time when
#            run outside TSSA (NSH Shell).
#        Servers must be passed in as a single option enclosed in double quotes
#            space separated, when run outside TSSA (NSH Shell).
#        Running without any options displays the usage.
#        Running without providing the -p option will automatically select and
#           install/upgrade to the highest available version.
#        Rollback and Uninstall are mutually exclusive options.
#        Rollback checks for a version below current that is not the 0-0 base.
#        Rollback and Upgrade check for and if necessary installs the BES Agent.
#
#
# Error Codes:
#      code    section            description
#      ----    -------            ----------------------------------------------
#      100     main               Unrecognized patch version
#      101     main               Failed to set patch version
#      102     main               Failed to set TARFILE
#      103     main               Requested version to remove is below installed
#                                   version
#      104     env_check          User mqm not found
#      105     env_check          Group mqm not found
#      106     env_check          MQ Server RPMs found installed
#      107     env_check          Error encountered creating paths on server
#      108     install_bes        Failed to install BES Agent
#      109     install_bes        Failed to copy actionsite.afxm file to path
#      110     install_bes        Failed to start BES Client on server
#      111     copy_files         Could not copy patch files from source server
#      112     copy_files         Failed to copy source files to target server
#      113     copy_files         Failed to unpack tarball on target server
#GVM##      114     unpack_files       Failed to copy BES Agent RPMs from source server
#      114     unpack_files       BES Agent RPMs not found on server
#GVM##      115     unpack_files       Failed to copy Corp actionsite.afxm file from source
#      115     unpack_files       Corp actionsite.afxm file not found on server
#      116     install_mq         Errors encountered during install/upgrade
#      117     install_mq         Failed to set primary instance on server
#      118     install_mq         Failed to install license on server
#      119     rollback_mq        Errors encountered during uninstall/rollback
#      120     rollback_mq        Failed to remove Patch RPMs (downgrade)
#      121     rollback_mq        Failed to set primary instance on server
#      122     rollback_mq        Failed to remove all MQ RPMs on server
#      123     env_check          Failed to remove .*tag files
#      124     ptc_symlink        Failed to create /opt/mqm symbolic link
#      125     ptc_symlink        Failed to remove /opt/mqm symbolic link
#      126     unpack_files       tar archive not found in DATAPATH on target
#GVM##      127     unpack_files       Failed to copy mn/actionsite.afxm file from source
#      127     unpack_files       PTC CPP actionsite.afxm file not found on server
#GVM##      128     unpack_files       Failed to copy og/actionsite.afxm file from source
#      128     unpack_files       PTC Ogden actionsite.afxm file not found on server
#      129     env_check          Unable to determine OS of server
#      130     env_check          Unable to determine install state on server
#      131     rollback_mq        No MQVERBASE PATCHVER patches found on server
#      132     rollback_mq        No MQSeries*_MQCV-*.rpm RPMs to remove on server
#      133     rollback_mq        Rollback requested, but no Fix Packs installed
#      134     env_check          IP Address not found in /etc/hosts
#      135     env_check          MQ Client version ${MAJVER} found - manual removal required
#      136     env_check          Multiple MQ Client installations detected
#      137     install_mq         Improper install detected. Missing *-0 RPMs
#      138     rollback_mq        Failed to set package manager for server
#      139     env_check          Failed to determine OS for server
#      140     fix_install        Errors detected after attempting to fix install
#
# History:
# -------- ---  ----------------------------------------------------------------
# 08/27/21 GVM  Initial creation
# 10/12/21 GVM  Moved license acceptance before install command. Fixed infinite
#               loop during DRYRUN for install_mq function when checking results
#               for PATCHVER -gt VER check. Added creation of install.log file
#               on target host in MQCVPATH per request. Updated print_msg to only
#               print specific TYPE statements, not both when DEBUG or DRYRUN modes
#               are in use.
# 11/18/21 GVM  Added MAJVER variable. Added logic to allow removal of MQ Client
#               versions below 9.x. Added BESClientDeployTool and BESRelay RPMs
#               to correctly remove older BESClient installs.
# 11/29/21 GVM  Added MQVERBASEMIN to represent new minimum base version.
#               Added SWFINDCMD, TAGCHK, and TAGRM for finding and removing
#               .*tag files.
#               Added -T flag for indicating PTC install environment. Added
#               ptc_symlink function to check for and if necessary, create /opt/mqm
#               symbolic link to /usr/mqm/MQCV.
# 03/01/22 GVM  Massive updates across the entire script
# 03/21/22 GVM  Updated for migration of source files to shared file system.
#               Corrected for MQCVPATH check to include /opt/mqm for PTC servers.
#               Added error check for missing IP address in /etc/hosts.
#               Updated awk script to grab all digits after last period in version
#               output of dspmqver command for VER variable.
#               Added logic to force manual uninstall for PTC installations not
#               running version 9 clients and installed in /opt/mqm.
# 04/12/22 GVM  Updated locations for BES Client files to /hamq/software/besclient
#               Added new variable HABES
# 04/19/22 GVM  Added INSTCNT variable and logic to check for multiple installations
#               of MQ Client. Adjust for tarball extraction into MQCV/... path.
# 01/06/23 GVM  Added code to display installation output - if any - during an
#               install failure (exit code 116). Added RPMMQBASECNT to check count
#               of *-0 RPMs (required for Fix Pack install). Added check for
#               RPMMQBASECNT=0 when MQ RPMs are installed indicating improper install.
# 02/16/23 GVM  Updated for version 9.3.0-3. Modified HOSTS option to remove ',;:\t'
#               Removed FPVER-redundant since VER is used. Made some aesthetic
#               changes to logging in env_check function.
# 06/09/23 GVM  Updates...
#
################################################################################
# VERY VERBOSE OUTPUT
if (( $( echo -e "$@" | grep -ic "verbose") )) ; then set -x ; fi
#
################################################################################
NSH="MQ_client_util"

HH="$( date +%H )"              # 15
MIN="$( date +%M )"             # 45
DD="$( date +%d )"              # 01
MM="$( date +%m )"              # 01
MMDD="${MM}${DD}"               # 0102
YYYY="$( date +%Y )"            # 2009

APPPATH='/usr/mqm'
APPPATHOUT=""
#GVM#typeset -i BASECMDLVL=930
BESACTION="actionsite.afxm"
BESAGENTBASE='BESAgent-'
BESCHKOUT=""
BESCLIENTPATH="/etc/opt/BESClient"
BESCLIENTRPMS='BESAgent-|BESClientDeployTool-|BESRelay-'
typeset -i BESINSTALL=0
CLEANCMD=""
typeset -i CPP=0
DATAPATH='/var/mqm'
DATAPATHOUT=""
typeset -i DEBUG=0
DSPMQVER='/bin/dspmqver -i'
typeset -i DRYRUN=0
typeset -i ERROR_CODE=0
ERRORDESC=""
typeset -i EXISTING=0
FINDARGS="-name 'lost+found' -prune -o \( -type f -o -type d \) -a \! "
FINDARGS+="\( -user 'mqm' -a -group 'mqm' \) -exec chown mqm:mqm {} \;"
FINDCMD='/usr/bin/find'
GETENT='/usr/bin/getent'
GREPNC='grep --color=never'
HABES='/hamq/software/besclient'
HAMQ='/hamq/software/mq'
HOSTS=""
INSTSERVER=""
IPADDR='0.0.0.0'
LICCHK=""
LINKCMD='ln -s ${(e)MQCVPATH} /opt/mqm'
LOGPATH=""
MAILX='/usr/bin/mailx'   # default for Linux servers
typeset -i MAJVER=0
typeset -i MAXCMDLVL=0
MQCVPATH="${APPPATH}/MQCV"
MQCVPATHOUT=""
MQINSTBASE='MQCV-'
MQLICENSE="${DATAPATH}/MQCV/mqlicense.sh -accept 2&gt;&amp;1"
MQRPMS='MQSeriesRuntime_ MQSeriesClient_ MQSeriesJava_ MQSeriesSDK_ MQSeriesJRE_ '
MQRPMS+='MQSeriesGSKit_ MQSeriesMan_ MQSeriesSamples_'
_MQRPMS=""
MQSERVERRPM='MQSeriesServer'
#GVM#MQUPBASE='U930'
#GVM#MQVERBASE='9.3.0-'
MQVERBASEERE='9[.][0-9]+[.]0-'
MQVERBASEMIN='0'
MQVERSION=""
typeset -i NEWINST=0
typeset -i OGDEN=0
typeset -i PATCHVER=0
PATHCHK=""
typeset -i PTC=0
typeset -i ROLLBACK=0
RPM_CMD='/bin/rpm'
RPMBASE='MQSeries'
RPMCHK="${RPM_CMD} -qa | grep --color=never -iE \"(${RPMBASE}|${BESCLIENTRPMS}).*\""
typeset -i RPMCHKOUT=0
RPMINST="${RPM_CMD} --prefix ${MQCVPATH} -i"
RPMINSTLIST=""
typeset -i RPMMQBASECNT=0
RPMPLATFORM=".x86_64"
RPMSUFFIX=".rpm"
RPMUPDATE="${RPM_CMD} --prefix ${MQCVPATH} -U"
RPMUPLIST=""
SETMQINST="${MQCVPATH}/bin/setmqinst -p ${MQCVPATH} -i 2&gt;&amp;1"
#GVM#SOURCEDIR="${DATAPATH}/MQCV-${MQINSTBASE}${MQVERBASE}"
SOURCEDIR='${(e)DATAPATH}/MQCV-${(e)MQINSTBASE}${(e)MQVERBASE}'
#GVM#SOURCEFILES='^${MQINSTBASE}${MQVERBASE}[0-9]+[.]tar[.]gz'
SOURCEFILES='^${MQINSTBASE}${MQVERBASEERE}[0-9]+[.]tar[.]gz'
SOURCEPATH="${HAMQ}/client"
SOURCESVR='***********'
STARS='********************************************************************************'
STARTBESCMD="/etc/init.d/besclient restart 2&gt;&amp;1 ; sleep 5 ; /etc/init.d/besclient status"
SVROS=""
SWFINDCMD="${FINDCMD} ${APPPATH:=_none_} -type f -iname '*.*tag'"
TAGCHK='${SWFINDCMD} -exec ls -l {} \;'
TAGRM='${SWFINDCMD} -exec /bin/rm -vf {} \; 2&gt;&amp;1'
TAR='/bin/tar'
typeset -i TARNUM=0
typeset -i UNINSTALL=0
typeset -i VER=0
YUM='/usr/bin/yum'
ZYPPER='/usr/bin/zypper'

################################################################################
# Functions
################################################################################
# critical_error
################################################################################
critical_error()
{
print_msg "ERROR_CODE=${ERROR_CODE}~nERRORDESC=${ERRORDESC}" "debug"

if &lsqb;&lsqb; ${ERROR_CODE} != 0 &rsqb;&rsqb;
  then
    echo "(${MM}/${DD} $(date +%R)) ${NSH}: failed ERROR_CODE $ERROR_CODE!!!" | tee -a "${TMPLOG}"
    echo "Error description : ${ERRORDESC}" | tee -a "${TMPLOG}"
#    cat "${TMPLOG}" &gt;&gt; ${MAILFILE}
#    ${MAILX} -s "${NSH}.ksh had problems" $MAILSUPPORT &lt; $MAILFILE
fi

cat "${TMPLOG}" | tee -a ${LOGFILE}

exit ${ERROR_CODE}
}
################################################################################
# usage
################################################################################
usage()
{
tee -a "${TMPLOG}" &lt;&lt; EOF

Usage:
${STARS}
${NSH}.nsh -s "&lt;host&gt; [&lt;host2&gt; &lt;hostN&gt; ...]" [-d] [-h] [-p &lt;#&gt;] [-R|-U] [-y]
        options enclosed in square brackets ([...]) are optional
        -d              Enable DEBUG output (optional, noisy)
        -h              Help - display this usage message
        -p # (3)        Patch Number
                         (3) optional for upgrades - will select
                             highest version available
        -R   (1)        ROLLBACK - uninstall latest FP from target
                         (1) cannot be run with Uninstall option (-U)
        -s "&lt;list&gt;"     Hosts, enclosed in quotes, space separated (required)
        -U   (1)        Uninstall MQ Client (optional)
                         (1) cannot be run with Rollback option (-R)
        -y              DRYRUN - execute DRYRUN (optional)


EOF

cat "${TMPLOG}" &gt;&gt; ${LOGFILE}

exit ${ERROR_CODE}
}
################################################################################
# print_msg
################################################################################
print_msg()
{
unset MSG TYPE

local MSG="${1}"
local TYPE="${2}"

# (U) convert variable to UPPERCASE
# (L) convert variable to lowercase
if [ "x${(L)TYPE}" = "xdebug" -o "x${(L)TYPE}" = "xdryrun" ]
  then
    # Prefix output with TYPE and display
    MSG="$( echo -e "${MSG}" | sed -e "s/~n/~n${(U)TYPE}: /g" -e 's/~n/\\n/g' )"
    if [ ${DEBUG} = 1 -a "x${(L)TYPE}" = "xdebug" ]
      then
        echo -e "${(U)TYPE}: ${MSG}" | tee -a "${TMPLOG}"
    fi
    if [ ${DRYRUN} = 1 -a "x${(L)TYPE}" = "xdryrun" ]
      then
        echo -e "${(U)TYPE}: ${MSG}" | tee -a "${TMPLOG}"
    fi
  else
    if &lsqb;&lsqb; ${#MSG} -ge 76 &rsqb;&rsqb;
      then
        echo -e "${STARS}\n${MSG}\n${STARS}" | tee -a "${TMPLOG}"
      else
        # Center output string between *'s across 80 columns padded by spaces
        echo -e "${STARS}\n* ${(j: :l:38:r:38:)MSG} *\n${STARS}" | tee -a "${TMPLOG}"
    fi
fi
}
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/86949</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/86949</guid><dc:creator><![CDATA[greg-michael]]></dc:creator><pubDate>Fri, 09 Jun 2023 20:25:14 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Fri, 09 Jun 2023 18:10:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/greg-michael" aria-label="Profile: greg-michael">@<bdi>greg-michael</bdi></a> said in <a href="/post/86944">Function List incomplete</a>:</p>
<blockquote>
<p dir="auto">code block inline</p>
</blockquote>
<p dir="auto">Is the only way I know of.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/86945</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/86945</guid><dc:creator><![CDATA[Michael Vincent]]></dc:creator><pubDate>Fri, 09 Jun 2023 18:10:09 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Fri, 09 Jun 2023 18:06:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a> Is there a way to upload the script as an attachment, or do I simply need to paste it in a code block inline?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/86944</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/86944</guid><dc:creator><![CDATA[greg-michael]]></dc:creator><pubDate>Fri, 09 Jun 2023 18:06:49 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Fri, 09 Jun 2023 16:40:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a> Let me take a look… I don’t think that there’s anything sensitive in it, but just to be safe…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/86942</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/86942</guid><dc:creator><![CDATA[greg-michael]]></dc:creator><pubDate>Fri, 09 Jun 2023 16:40:36 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Fri, 09 Jun 2023 14:41:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/greg-michael" aria-label="Profile: greg-michael">@<bdi>greg-michael</bdi></a> said in <a href="/post/86937">Function List incomplete</a>:</p>
<blockquote>
<p dir="auto">I have those in other functions as well, and those functions appear in my functions list.</p>
</blockquote>
<p dir="auto">Interesting … ?</p>
<p dir="auto">Can you post the entire script, or does it contain info you don’t want public?</p>
<p dir="auto">Cheers.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/86938</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/86938</guid><dc:creator><![CDATA[Michael Vincent]]></dc:creator><pubDate>Fri, 09 Jun 2023 14:41:57 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Fri, 09 Jun 2023 14:32:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a> OK, I can buy that. Any suggestions on how to manage escaped quotes? I have those in other functions as well, and those functions appear in my functions list.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/86937</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/86937</guid><dc:creator><![CDATA[greg-michael]]></dc:creator><pubDate>Fri, 09 Jun 2023 14:32:56 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Thu, 08 Jun 2023 19:10:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/greg-michael" aria-label="Profile: greg-michael">@<bdi>greg-michael</bdi></a> said in <a href="/post/86878">Function List incomplete</a>:</p>
<blockquote>
<p dir="auto">"RESULT=$?"</p>
</blockquote>
<p dir="auto">For my testing, it seems to be the escaped double-quotes in the expression you highlight:</p>
<p dir="auto"><code> ...  \"RESULT=\$?\"  ...</code></p>
<p dir="auto">If I change that part to:</p>
<p dir="auto"><code> ...  RESULT=\$?  ...</code></p>
<p dir="auto">All my functions show.  If I have the escaped double-quotes in, then the function following that line does <em>not</em> appear in the function list.</p>
<p dir="auto">Cheers.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/86921</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/86921</guid><dc:creator><![CDATA[Michael Vincent]]></dc:creator><pubDate>Thu, 08 Jun 2023 19:10:43 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Thu, 08 Jun 2023 19:01:48 GMT]]></title><description><![CDATA[<p dir="auto">Should this be logged as a bug or some sort of defect? Anyone have any suggestions on how to modify the bash.xml functionList file to accommodate the use of semi-colons?</p>
<p dir="auto">I suspect that this part of the function node is causing the issue:</p>
<pre><code>[^{;]*?\{                                           # no semi-colon until start of body
</code></pre>
<p dir="auto">The line in question is within an if-then-else body, and there are lines elsewhere within my script inside other functions that are displayed in the functions list that use inline semi-colons in the same way that are not exhibiting this behavior within NP++.</p>
<p dir="auto">Worst case scenario, it’s a minor inconvenience. Just hoping that someone a little more familiar with this code might have an idea.</p>
<p dir="auto">Thanks!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/86920</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/86920</guid><dc:creator><![CDATA[greg-michael]]></dc:creator><pubDate>Thu, 08 Jun 2023 19:01:48 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Tue, 06 Jun 2023 18:39:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a> said in <a href="/post/86856">Function List incomplete</a>:</p>
<blockquote>
<p dir="auto">I suspect it’s not this function, but rather what else is in your script that is causing the issue:</p>
<p dir="auto">comments, newlines, mismatched braces … ?</p>
<p dir="auto">Cheers.</p>
</blockquote>
<p dir="auto">OK, so this is really weird. I simply cut the entire function from the script, moved it above the function that immediately precedes it, saved it, and the function list automatically added it.</p>
<p dir="auto">Testing further, I moved the other function elsewhere in the script, saved it, and the function that immediately follows that function now no longer shows up in the functions list.</p>
<p dir="auto">Isolating the function in question, there is no issue with it displaying in the functions list. There must be something at the end of the function that is causing the issue.</p>
<p dir="auto">A bunch of commenting, saving, uncommenting, saving, etc. brings it down to this single line:</p>
<pre><code>LINKCMDOUT="$( nexec -i -l ${DSSVR} "${(e)BASELINKCMD} 2&gt;/dev/null ; echo -e \"RESULT=\$?\" ; sleep 5 ; ${FINDCMD} /opt -maxdepth 1 -type l -ilname '*mqm*' -ls 2&gt;/dev/null" )"
</code></pre>
<p dir="auto">It doesn’t like the semi-colons.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/86878</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/86878</guid><dc:creator><![CDATA[greg-michael]]></dc:creator><pubDate>Tue, 06 Jun 2023 18:39:09 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Tue, 06 Jun 2023 18:05:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a> When I run the script, there are no errors regarding mismatched/unmatched parentheses, braces, brackets, etc. It also makes me wonder why the other functions would show up in my functions list, but not this one. I’ll see about yanking the whole thing out, saving it, closing NPP, and then adding it back in. Might be some trial and error, but maybe there’s something there that shouldn’t be that I just am not seeing.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/86877</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/86877</guid><dc:creator><![CDATA[greg-michael]]></dc:creator><pubDate>Tue, 06 Jun 2023 18:05:45 GMT</pubDate></item><item><title><![CDATA[Reply to Function List incomplete on Tue, 06 Jun 2023 00:39:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/greg-michael" aria-label="Profile: greg-michael">@<bdi>greg-michael</bdi></a> said in <a href="/post/86853">Function List incomplete</a>:</p>
<blockquote>
<p dir="auto">For some reason, this function refuses to show up in the list</p>
</blockquote>
<p dir="auto">I suspect it’s not this function, but rather what else is in your script that is causing the issue:</p>
<p dir="auto"><img src="/assets/uploads/files/1686011933213-fa4155e5-c66a-4330-a651-28b33de1f255-image.png" alt="fa4155e5-c66a-4330-a651-28b33de1f255-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">comments, newlines, mismatched braces … ?</p>
<p dir="auto">Cheers.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/86856</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/86856</guid><dc:creator><![CDATA[Michael Vincent]]></dc:creator><pubDate>Tue, 06 Jun 2023 00:39:26 GMT</pubDate></item></channel></rss>