Bash script to overwrite/append destination file with options menu [duplicate]
Clash Royale CLAN TAG #URR8PPP up vote -2 down vote favorite This question already has an answer here: How to debug bash script? 7 answers I'm trying to write a bash script to prompt a user for a filename, and if the file exists, allow them to overwrite or append the file. For some reason, I keep getting returned with a syntax error despite having an issue. Unfortunately, I am not as familiar with Bash as I am with Python, and find myself confusing the syntax of the two. Nevertheless, please see below: #!/bin/bash echo "Please enter the name of your destination file: " read destFile if [ -f "$destFile" ]; then echo "This file exists." fi echo "Please enter the name of your source file: " read sourceFile echo "Do you want to 1) Overwrite, 2) Append, 3) Exit?" echo "Please select your option: " options=("Overwrite" "Append" "Exit") while [ -e "$sourceFile" ]; do ...