一条命令中的Linux shell单引号和双引号

标签 linux shell

我需要你的帮助才能使这个命令生效:

ssh -t user@localhost "cd /tmp ; PROMPT_COMMAND='echo -ne "\033]0;log\007"' ; bash"

这是我得到的错误:

bash: -c: line 0: unexpected EOF while looking for matching `''
bash: -c: line 1: syntax error: unexpected end of file
Connection to localhost closed.
log007' ; bash: command not found

谢谢

最佳答案

我建议用反斜杠转义双引号 (\"):

ssh -t user@localhost "cd /tmp ; PROMPT_COMMAND='echo -ne \"\033]0;log\007\"' ; bash"

关于一条命令中的Linux shell单引号和双引号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36845507/

相关文章:

python - 有没有简单的方法来对 Python 脚本进行基准测试?

c - pthread_create 在编译时返回错误

linux - 以日期作为名称前缀的 Unix 文件列表

c - 编译C代码的脚本

bash - 根据 mathrules 在 bash 脚本中相乘

c - 用 C 编写自己的 Unix shell - PATH 和 execv 的问题

ios - 构建我的项目时出现 Xcode 10 beta 错误?

linux - 为旧内核设置 buildroot

linux - 如何在现有静态库的开头添加新的目标文件

Linux 终端 : Run command when changing directory