quote in ssh bash -c

icy1900

Roy

Posted on September 10, 2021

quote in ssh bash -c

alt text

    cmd="find $volumePath/data -maxdepth 1 -type f -name 'GRA_*.log' -print0 | xargs -0 -n 100 rm -v"
    # 双引号中bash子命令需要使用 `\"` 引用,否则会报错 "xargs argument line too long"
    ssh -p $sshPort $hostIP -- "bash -c \"$cmd\""
Enter fullscreen mode Exit fullscreen mode

https://serverfault.com/q/953087/576644

💖 💪 🙅 🚩
icy1900
Roy

Posted on September 10, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

quote in ssh bash -c
linux quote in ssh bash -c

September 10, 2021