Quantcast
Channel: Bashタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 2722

bashで"を二重で使う方法

$
0
0

やりたいこと

echoでsed "${line},10d" hoge.txtと出力したい

問題点

# これだと""が思い通りに解釈されないecho"sed "${line},10d" hoge.txt"# これだと変数が展開されないecho'sed "${line},10d" hoge.txt'

対処方法

海外の記事にあったけどなんかしっくりこない。
誰かいい方法合ったら教えてください。
"を変数に代入すればいいらしい。

dqt='"'echo"sed ${dqt}${line},10d${dqt} hoge.txt"

Viewing all articles
Browse latest Browse all 2722

Trending Articles