This article introduces how to escape single quotes within single quotes within single quotes in Bash language on Linux PC/server command line.

Escaping single quotes in bash is as follows:
'\''
So, how do you escape if there’s a single quote inside code enclosed by '''?
'\''\'\'''\''
I also wrote code like this and actually created a situation with single quotes within single quotes within single quotes, but it seems that escaping multi-layered single quotes is more complex than expected.
cd "${1}" && ls | xargs -I {} bash -c ' dirname="$( echo "{}" | awk '\''{print $10}'\'' )" ; [[ -d "${dirname}" ]] && [[ ! "${dirname}" =~ ^\.\.$ ]] && echo "{}" | awk -v dirname="${dirname}" '\''{ " du -h "dirname" | tail -1 | awk '\''\'\'''\''{ print $1 }'\''\'\'''\'' " |& getline $11 ; print $0 }'\'' ' ; cd - # great
If you want to know deeper single quote escape sequences, the following page and script will be helpful.
quotify(){
cat << 'EOT' > ${HOME}/quotify ; chmod 755 ${HOME}/quotify ; ${HOME}/quotify
#!/usr/bin/perl -pl
s/'/'\\''/g;
$_ = qq['$_'];
EOT
}
bash - How to escape single quotes within single quoted strings? - Stack Overflow