ファイルと 1 行のコードをプログラムに渡そうとしています。
私の行:
i := 1;
私のファイル(ファイル):
blah1
blah2
blah3
プログラムへの入力:
i := 1;
blah1
blah2
blah3
次のような1行になると思います。
example < `echo "i := 1;\n" cat file`
またはそのようなもの
{ echo 'i := 1;' ; cat myfile.txt ; } | example
(
echo "i := 1"
cat file
) | program
必要なのは、ここに文字列です:
example <<< `echo "i:=1" && cat file`
bash マニュアルから:
3.6.7 Here Strings
A variant of here documents, the format is:
<<< word
The word is expanded and supplied to the command on its standard input.