LINUX.ORG.RU
ФорумAdmin

bash $? ssh


0

0

ssh $host "sh -c 'grep ggggbash /etc/shells;echo $?'" 0

ssh $host "sh -c 'grep bash /etc/shells;echo $?'" /usr/local/bin/bash 0

Почему код возврата всегда 0 ?

если зайти на сервер и выполнить туже самую команду, то ответ правильный. в первом случае 1 во втором 0.

★★

В дополнение к bigbit:

ssh $host "sh -c 'grep ggggbash /etc/shells'"; echo $?

из man ssh:
"Bash’s exit status is the exit status of the last command executed in the script. If no commands are executed, the exit status is 0."

Slavaz ★★★★★
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.