#!/bin/bash
function ctrl_c() {
echo -e "\n[!] Exiting...\n"
exit 1
}
# Ctrl+C
trap ctrl_c INT
function help() {
echo -e "[+] Use:\n"
echo -e "\t-f [filename]"
echo -e "\t-h help"
exit 1
}
function my_function() {
sleep 5
echo $filename
}
parameter_counter=0; while getopts ":f:h" args; do
case $args in
f) filename=$OPTARG && let parameter_counter+=1;;
h) help;;
esac
done
if [ $parameter_counter -ne 1 ]; then
help
else
my_function
fi