On Thu, 5 Mar 2020, Christoph Berg wrote:
Re: Tomas Pospisek 2020-03-05
<158341012952.22047.14835993299149410230.reportbug@hier>
if for whatever reason a cluster status line will contain the string
`Port`, then that line will be filtered out.
I instead suggest to do:
PORT=$(($(pg_lsclusters | tail -n +2 | awk '{print $3}' | sort -n | tail
-1) + 1))
`tail -n +2` will output all lines starting from line 2 on (line
numbering starts at 1), thus omitting the "table header".
pg_lsclusters -h
Even better, thanks! This then gives:
PORT=$(($(pg_lsclusters -h | awk '{print $3}' | sort -n | tail -1) + 1))