実際のところ
普通に文字列を渡す
$ bash -c "echo 12" 12 $ sh -c "echo 12" 12
ファイルから読んでみる
$ cat samplecode.txt echo 134 $ sh -c "`cat samplecode.txt`" 134
これは普通のshコマンドつなぎと結果は同じです。
$ sh < samplecode.txt 134 $ cat samplecode.txt | sh 134
$ bash -c "echo 12" 12 $ sh -c "echo 12" 12
$ cat samplecode.txt echo 134 $ sh -c "`cat samplecode.txt`" 134
これは普通のshコマンドつなぎと結果は同じです。
$ sh < samplecode.txt 134 $ cat samplecode.txt | sh 134