Help with bash escaping while using screen command

Hello, everyone. I'm currently trying to write a command system for a Minecraft server using screen .
Here are the scripts I'm currently using.

0.sh

#!/bin/bash
screen -S Test114 -dm java -Xmx4G -jar server.jar nogui

1.sh

#!/bin/bash
args="$@"
args2="${args@Q}"
#args3=`printf '%q\n' "$args"`
echo "args:" $args
echo "args2:" $args2
#echo "args3:" $args3
#printf "$args3"
screen -S Test114 -p 0 -X stuff "$args \r"

The problem is that when attempting to send commands with backslashes in them, the screen command ends up trying to interpret the backslashes.
For example, when I type ./1.sh say \\\\ , it'll turn into say \\ .
However, screen then further tries to interpret the backslashes. This results in say \ .
Is there any way I could write this to get the results I desire? (Also, sorry for the formatting. I tried my best)

Welcome to the forum.

Quoting usually helps. Try

./1.sh "say \\\\"

or

./1.sh 'say \\\\'

. Make sure you don't use non-ASCII locale quotes as sometimes introduced by non-*nix editors. On top, using quotes within the script is best practice.

1 Like

Thank you so so much! This fixed everything!