Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次のファイルがあります
linux$ cat test.txt toto titi tete tata
cat 出力を変数に保存すると、改行が破棄されます
linux$ msgs=`cat test.txt` linux$ echo $msgs toto titi tete tata
変数に改行を含む出力を保持する方法は?
私はこれを持っていました:
echo $(cat myfile.sh) >> destination.sh
それが問題の原因だったので、次のように変更しました。
cat myfile.sh >> destination.sh
そしてそれはうまくいきました、lulz