I currently have two bash functions, one which uploads, and another that downloads a file. I would like to create a bash script that allows users to specify which of the two they would like to do.
The issue I am having is the upload and download function run no matter what. For example:
function upload() {
var=$1
#something goes here for upload
}
function download() {
var=$1
#something here for download
}
main() {
case "$1" in
-d) download "$2";;
-u) upload "$2";;
*) "Either -d or -x needs to be selected"
esac
}
I cannot get main() to run only and suppress download and upload until needed.
select.main(), or if you want to keep it, callmain "$@"in the endmain?