0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

(メモ)ssh でコマンドを指定すると、 IFS でつなげてながしこまれるっぽい?

Posted at
$ ssh test-vagrant ls
test-dir

$ ssh test-vagrant sh -c "ls ~/test-dir"
test-dir

$ ssh test-vagrant sh -c '"ls ~/test-dir"'
fuga.txt
hoge.txt

strace で何が起こっているのか見てみると、2番目のコマンドでは、

["sh", "-c", "ls", "/home/vagrant/test-dir"]

がリモートで実行されている。

なので、コマンドの部分は、IFS で結合されてリモートのシェルに文字列として system() 実行されているっぽい?

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?