株式会社ヴァンデミックシステム

Blog

<スポンサーリンク>

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
yuta@DESKTOP-V36210S:/mnt/c/yuta$ word=klmno
# 変数が展開されない
yuta@DESKTOP-V36210S:/mnt/c/yuta$ cat test.txt | sed '$a $word'
abcde
fghij
$word
yuta@DESKTOP-V36210S:/mnt/c/yuta$
# 変数がされる
yuta@DESKTOP-V36210S:/mnt/c/yuta$ cat test.txt | sed '$a '$word''
abcde
fghij
klmno
yuta@DESKTOP-V36210S:/mnt/c/yuta$
yuta@DESKTOP-V36210S:/mnt/c/yuta$
yuta@DESKTOP-V36210S:/mnt/c/yuta$ word=klmno # 変数が展開されない yuta@DESKTOP-V36210S:/mnt/c/yuta$ cat test.txt | sed '$a $word' abcde fghij $word yuta@DESKTOP-V36210S:/mnt/c/yuta$ # 変数がされる yuta@DESKTOP-V36210S:/mnt/c/yuta$ cat test.txt | sed '$a '$word'' abcde fghij klmno yuta@DESKTOP-V36210S:/mnt/c/yuta$ yuta@DESKTOP-V36210S:/mnt/c/yuta$
yuta@DESKTOP-V36210S:/mnt/c/yuta$ word=klmno

# 変数が展開されない
yuta@DESKTOP-V36210S:/mnt/c/yuta$ cat test.txt | sed '$a $word'
abcde
fghij
$word
yuta@DESKTOP-V36210S:/mnt/c/yuta$ 

# 変数がされる
yuta@DESKTOP-V36210S:/mnt/c/yuta$ cat test.txt | sed '$a '$word''
abcde
fghij
klmno
yuta@DESKTOP-V36210S:/mnt/c/yuta$
yuta@DESKTOP-V36210S:/mnt/c/yuta$

<スポンサーリンク>

2 Comments

2 Records

  1. on 2021年2月16日 at 3:37 PM
    210seikatsu wrote:

    知りたかったのはまさにこれですこれ!感謝!

    返信
    • on 2021年3月13日 at 6:23 PM
      yuta wrote:

      とんでもありません!

      返信

コメントを残す

Allowed tags:  you may use these HTML tags and attributes: <a href="">, <strong>, <em>, <h1>, <h2>, <h3>
Please note:  all comments go through moderation.

*

日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)