Something similar to Python's repr is printf %q which could be combined with printf -v which "prints" into another variable instead of stdout. (though non-standard, it's supported in the printf built-in from bash and zsh):
[prompt] foo=$(cat <<'EOT'
[prompt] printf '%q\n' "$foo"
Because $(python3 -c "print('$1')") is a string not a logical value, and [ ... ] is just testing whether the string is non-empty.
To make it work the way you expect, change the test to
if [ "$(python3 -c "print('$1')")" = "True" ]
BTW you should avoid using test as the name of your function(s) since that will mask the shell builtin test.
A couple of things: if THIS_DIR contains dirname -bash, cp -Ri $THIS_DIR/... expands to the equivalent of cp -Ri dirname -bash/... (because of word splitting), that is, cp gets dirname and -bash/... as distinct arguments. That second one starts with a dash, so it tries to interpret the letters in it as options. GNU cp doesn't have -h as an option, so it ...
Since you didn't state which apt-based Linux distribution you're using, I will suppose it's Debian. This should apply for derived distributions, as long as the package equivs below exists.
You really should upgrade your system to a recent/supported version, because you'll start having more and more dependency problems.
Anyway, In order to satisfy your ...
pyp2rpm -o fedora --srpm -p3 ebooklib
will produce an SRPM, which you can the build using Mock.
Copr can automate this for you. See https://docs.pagure.org/copr.copr/user_documentation.html#pypi
New build -> Select the source type -> PyPI -> file in the name -> Build
You probably have an invalid character somewhere in your shebang line. Since you're the one who inserted it, it's likely a carriage-return, i.e. your line ends with a newline and a carriage return (or vice-versa) - in the ODS style of line breaking.
Try using dos2unix on your script file to convert all the line breaks to only be 0x10 (UNIX-style).
You are mixing up two unrelated package magament systems (RPM and pip). They are not designed to communicate, use different models. It could be done, but it is better to have just one and not a hairball of separate systems that somewhat agree.
There aren't really magic numbers for the ext4 inode format (though more on that later), so what you are asking for isn't exactly possible. There are tools like "findsuper" in the e2fsprogs code, and ext3grep, that will scan a device and find superblock magic numbers (maybe backups) and then you could try to use e2fsck to recover from that.
Since ext4 has ...
I ended up doing following:
rebuild and install Python you want to uninstall using custom prefix, let's say $HOME/opt/Python-3.8.0: tar tJf Python-3.8.0.tar.xz && cd Python-3.8.0 && ./configure --prefix $HOME/opt/Python-3.8.0 && make && make install
cd $HOME/opt/Python-3.8.0 && find * -type f | perl -pe's(^)(/usr/)' | ...