79422147

Date: 2025-02-07 21:00:14
Score: 1
Natty:
Report link

Grateful thanks to @Fravadone for illuminating the root of the problem. I mistakenly remembered that I had to use the " symbol when specifying ssh options.That is why I wrote e.g.:o1='"NumberOfPasswordPrompts=0"' So this is the good syntax:

o1=NumberOfPasswordPrompts=0
o2=NumberOfPasswordPrompts=1
o3=ConnectTimeout=100

x=`sshpass -p "$psw" ssh -q -o $o2 -o $o3 2>/dev/null $usr@$srv <<ZZZ
 ### some command e.g.:
 sudo -u oracle -i
 export LANG=en_US.UTF-8
 ORACLE_HOME=$home
 export ORACLE_HOME   # export ORACLE_BASE ORACLE_HOME
 PATH=\\$ORACLE_HOME/bin:\\$PATH
 \\$ORACLE_HOME/OPatch/opatch lsinv
ZZZ`

And also good without the '=' sign. (But it isn't documented.) In this case, of course I have to use the " sign.

o1="NumberOfPasswordPrompts 0"
o2="NumberOfPasswordPrompts 1"
o3="ConnectTimeout 100"

x=`sshpass -p "$psw" ssh -q -o "$o2" -o "$o3" 2>/dev/null $usr@$srv <<ZZZ
 ### some command e.g.:
 sudo -u oracle -i
 export LANG=en_US.UTF-8
 ORACLE_HOME=$home
 export ORACLE_HOME   # export ORACLE_BASE ORACLE_HOME
 PATH=\\$ORACLE_HOME/bin:\\$PATH
 \\$ORACLE_HOME/OPatch/opatch lsinv
ZZZ`
Reasons:
  • Blacklisted phrase (0.5): thanks
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @Fravadone
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: László Szilágyi