[Solved] How to create a flag with getopts to run a command

Your script has a number of problems. Here is the minimal list of fixes to get it working: While is not a bash control statement, it’s while. Case is important. Whitespace is important: if [“$CHECKMOUNT”= “true”] doesn’t work and should cause error messages. You need spaces around the brackets and around the =, like so: … Read more