인용문을 인용하는 방법이 궁금합니다.

인용문을 인용하는 방법이 궁금합니다.

안녕하세요 저는 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!"}]'

관련 정보