export: Illegal option -f

By xngo on February 21, 2019

If you get the error message export: Illegal option -f or YOUR_SCRIPT_NAME: not found from your script, it is likely that:

  • You didn't put #!/bin/bash at the top of your script. Make sure that it is in every script files.
  • You call script using sh. Don't do that. Use ./script.sh instead of sh YOUR_SCRIPT_NAME.sh

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.