I have written a program in linux bash and following are ways to start/stop that program:
start_program
stop_program
restart_program.
I have copied above scripts in /usr/bin so these scripts are working as command. but I want that instead of above commands I just type program name then pass action as parameter. for example if i want to start program then i should write on command prompt:
ProgramName start
if i want to uninstall then
ProgramName uninstall
if restart
ProgramName restart
so how can i make it that i just write Program name then pass action as parameter and Press enter to do that thing.
A common approach is to use a case statement:
If your
restartis juststopthenstart, you can do: