It gives an error in the second line, although in the terminal the same command works fine. Please see what is wrong. Here is the script itself:
#!/bin/bash echo удалить файлы \: `find !(*.cpp) -maxdepth 0` \? read -n 1 x while( [ "$x" -ne "y" && "$x" -ne "n" ] ) do if [[ "$x" -eq "y" ]] then rm `find !(*.cpp) -maxdepth 0` else if [[ "$x" -ne "n" ]] then echo введён неверный символ, повторите ввод read -n 1 x if done