Fixed: on selection the text is copied, so it is impossible to replace the text with what is in clipboard as the content of clipboard is already replaced by old text.
https://emacs.stackexchange.com/questions/74298/setq-select-enable-primary-t-breaks-copy-paste-in-emacs-28
#!/bin/bash
set -x -e
emacsdir=~/.emacs.d
compatfile=$emacsdir/.emacs-ver
mylispdir_old=$emacsdir/my
mylispdir_new=$emacsdir/mylisp
if ! [[ -f $compatfile ]]; then
echo 'Cannot detect compatibility.'
exit 1
fi
read ver <$compatfile
if [[ $ver != 1 ]]; then
echo 'Script is designed only for upgrade: v1 => v2.'
exit 1
fi
rm $mylispdir_old/init.el || :
mv $mylispdir_old $mylispdir_new || :
rm $emacsdir/.emacs-my.elc || :
echo 2 >$compatfile