Pasar parámetros mediante el archivo de script de shell para esperar el script

Pasar parámetros mediante el archivo de script de shell para esperar el script

Necesito pasar un parámetro desde un script de shell en la línea de comando del script ssh

Por ejemplo :

#!/usr/bin/expect
spawn ssh [email protected] "cm1+passingparameters.sh;cmd2"

mi script existente 123.shque está funcionando bien.

#!/usr/bin/expect

spawn ssh [email protected] "/pstools/85419/jre/bin/java -Xms1024M -Xmx1024M -Dhttps.protocols=TLSv1.2 -Djdk.tls.client.protocols=TLSv1.2 -jar /app1/non/psoft/85419/gu1/gust/classes/SVC_TestS.jar https://decorp6-- tst4.custhelp.com/services/rest/connect/v1.3/incidents userid password ssow.proxy.com port;cd /app01/nonhr/psoft/85419/gucq1/gecust;mail -s 'OTO' [email protected] < logs.txt"

expect "password"

send "mypassword\r"

interact

expect eof

Quiero 2 guiones a.shyb.sh

a.shdebe ser el siguiente (observe el cambio con respecto al guión original mencionado anteriormente PASS b.sh after .jar)

#!/usr/bin/expect

spawn ssh [email protected] "/pstools/85419/jre/bin/java -Xms1024M -Xmx1024M -Dhttps.protocols=TLSv1.2 -Djdk.tls.client.protocols=TLSv1.2 -jar /app1/non/psoft/85419/gu1/gust/classes/SVC_TestS.jar PASS b.sh;cd /app01/nonhr/psoft/85419/gucq1/gecust;mail -s 'OTO' [email protected] < logs.txt"
expect "password"

send "mypassword\r"

interact

expect eof

b.shdebe ser el siguiente

#!/user/ksh
 https://decorp6--tst4.custhelp.com/services/rest/connect/v1.3/incidents userid password ssow.proxy.com port

Respuesta1

Ipensarestás preguntando cómo insertar varios argumentos en el javacomando remoto, que puede ser tan simple como

#!/usr/bin/expect

if {[llength $argv] == 0} {
  puts stderr "Usage: todo fixeme"
  exit 1
}

set the_args [join $argv]

spawn ssh [email protected] "/pstools/85419/jre/bin/java ... -jar /app1/non/psoft/85419/gu1/gust/classes/SVC_TestS.jar $the_args; ..."
...

Y luego ejecutarías lo anterior a través de algo como:

$ whatyousaveditas https://decorp6--tst4.cu... user pass ...

información relacionada