巨大なテキストをエコーし​​、引数リストが長すぎるエラーを提供します。

巨大なテキストをエコーし​​、引数リストが長すぎるエラーを提供します。

Linuxでは、膨大な量のテキスト(約500KB)をファイルに出力するのが困難です。テキストにスペース、特殊文字などが含まれています...エラー/ bin / sh:引数リストが長すぎます。

#!/bin/bash
txt="---huge text separated by line and containing special characters---"
echo $txt

または

#!/bin/bash
txt="---huge text separated by line and containing special characters---"
echo $txt >> filename.txt

ベストアンサー1

「と」エスケープを回避するための回避策は、スクリプトを表示するときに出力を読み取ることができるようにすることです。 cat >output <<textmarker -施工芸:

#!/bin/bash

cat >filename.txt <<EOT
Your output-text starts here
Every new line or tab  will be on the output too
  "text0" 'text1'  echo "Hello" 
  #Any other even huge text   //
\n But Dollarsign and backslash have to be escaped 
For example \$ and \\
your output-text ends with this marker, which had to be on a newline without whitespace
EOT

おすすめ記事