I found similar questions but not in Linux/Bash
I want my script to create a file with a given name (via user input) but add number at the end if filename already ex
Use touch or whatever you want instead of echo:
echo file$((`ls file* | sed -n 's/file\([0-9]*\)/\1/p' | sort -rh | head -n 1`+1))
Parts of expression explained:
ls file*sed -n 's/file\([0-9]*\)/\1/p'sort -rhhead -n 1