Сбор скриптов bash в каскаде

Я столкнулся с той же проблемой и, посоветовавшись с man ssh, выяснил:

# Problem: if you copy & paste those two lines together into a shell, 
# then the second command is not executed. 
# But if you run each line on its own, it will work
srcdirs=$(ssh myserver "ls -1 /home")
echo "$srcdirs"   # command is also not recorded by history

# Solution: Redirect stdin from /dev/null
srcdirs=$(ssh -n myserver "ls -1 /home")
echo "$srcdirs"

Надеюсь, это решит вашу проблему...

-1
22.10.2021, 01:35
0 ответов

Теги

Похожие вопросы