引用符を使用する方法を混乱させる

引用符を使用する方法を混乱させる

こんにちは、私はbashとコーディング全体について完全に最初に触れました。実行したい画面コマンドがあります。 「ftb」画面でMinecraftコンソールを実行しています。

screen -S ftb -p 0 -X stuff "tellraw @p ["",{"text":"This is a text!","bold":true,"color":"gold"},{"text":"\n"},{"text":"More text to be seen here!"},{"text":"\n"},{"text":"HAVE SOME TEXT IN UR FACE!","color":"green","clickEvent":{"action":"open_url","value":"https://google.com"}},{"text":"\n"},{"text":"Have Fun!"}]"

ただし、コマンドはすべての引用符と混同されます。今まで試してみましたが、運がありませんでした...

#! /bin/sh

say_this()

{
        screen -S ftb -p 0 -X stuff "$1^M"
}

say_this "tellraw @p ["",{"text":"This is a text!","bold":true,"color":"gold"},{"text":"\n"},{"text":"More text to be seen here!"},{"text":"\n"},{"text":"HAVE SOME TEXT IN UR FACE!","color":"green","clickEvent":{"action":"open_url","value":"https://google.com"}},{"text":"\n"},{"text":"Have Fun!"}]"

画面がすべての引用符を無視し、コマンド全体をMinecraftコンソールに送信し、「ftb」画面で実行するようにMinecraftコンソールで実行したいコマンドをカプセル化する方法はありますか?

コマンドはコンソールで作成および実行する必要があります。

tellraw @p ["",{"text":"This is a text!","bold":true,"color":"gold"},{"text":"\n"},{"text":"More text to be seen here!"},{"text":"\n"},{"text":"HAVE SOME TEXT IN UR FACE!","color":"green","clickEvent":{"action":"open_url","value":"https://google.com"}},{"text":"\n"},{"text":"Have Fun!"}]

ベストアンサー1

それは何もない殻ですscreen。内容全体を一重引用符で囲む必要があります。一重引用符の唯一の特殊文字は、一重引用符(引用符で終わる)です。

したがって、この文はこうなるべきです。

say_this 'message'

例えば

say_this 'tellraw @p ["",{"text":"This is a text!","bold":true,"color":"gold"},{"text":"\n"},{"text":"More text to be seen here!"},{"text":"\n"},{"text":"HAVE SOME TEXT IN UR FACE!","color":"green","clickEvent":{"action":"open_url","value":"https://google.com"}},{"text":"\n"},{"text":"Have Fun!"}]'

おすすめ記事