Bash Script - batch rename files in current directory with preview
Checking if a value is not empty

This is a very complicated way to check that value is not empty:


lines=$(echo -en "$value" | wc -m)

if [ "$lines" -gt 0 ]; then



This is equivalent:

if [ "$value" ]; then


Avoid echo -e

It's good to avoid all flags of echo, such as -e,
because they are not portable.
Instead of this:


 echo -e "Folder .script-history does not exist and gets created... \n";



I recommend to add a second empty echo:

echo "Folder .script-history does not exist and gets created..."
echo


The concern about A &amp;&amp; B || C

Shellcheck raised an issue here:


 rename "s/$search/$replace/g" ./*\
 &amp;&amp; { echo "success :-)"; }\
 || { echo "failed :-("; };;



The issue is that if rename succeeds but then echo success fails,
the || will get executed.
You can ignore this issue, because in the unlikely event that the first echo fails, the second (after the ||) is likely to fail too, so it won't matter.
If you want to be pedantic/bullet-proof, then you have to spell out a proper if-else statement instead of the &amp;&amp; ... || chaining.

In any case, the command can be simplified without the grouping:

rename "s/$search/$replace/g" ./* \
&amp;&amp; echo "success :-)" \
|| echo "failed :-(" ;;


I also added spaces in front of the \ before the line breaks,
to make it perfectly clear that the argument before the \ is not being continued on the next line.
Without that, this point would be ambiguous, making the script a bit harder to read.

The concern about read without -r

If the user input contains \, it may not get preserved.
That's hardly ever intended,
and probably you would not want that either.
As a rule of thumb,
it's good to always use read -r.