gpt4 book ai didi

linux - mkdir : missing operand - ssh -tt ${REMOTE_SERVER} sudo sh -c "mkdir -p/opt/migration"

转载 作者:太空宇宙 更新时间:2023-11-04 10:22:55 26 4
gpt4 key购买 nike

给定:

MIGRATION_FOLDER=/opt/migration

要么这样:

ssh -tt ${REMOTE_SERVER} sudo sh -c "mkdir -p /opt/migration"

或者这个:

ssh -tt ${REMOTE_SERVER} sudo sh -c "mkdir -p '$MIGRATION_FOLDER'"

返回:

mkdir: missing operand

感谢帮助。

最佳答案

您需要额外的报价。

ssh -tt ${REMOTE_SERVER} sudo sh -c "'mkdir -p \"$MIGRATION_FOLDER\"'"

或:

ssh -tt ${REMOTE_SERVER} "sudo sh -c 'mkdir -p \"$MIGRATION_FOLDER\"'"

如果您需要执行多个命令,请将它们全部放在单引号内。

ssh -tt ${REMOTE_SERVER} "sudo sh -c 'rm -rf \"$MIGRATION_FOLDER\"; mkdir -p \"$MIGRATION_FOLDER\"'"

关于linux - mkdir : missing operand - ssh -tt ${REMOTE_SERVER} sudo sh -c "mkdir -p/opt/migration",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43105699/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com