I need help creating a shell script to toggle between two commands.
When it is run command1
is executed then if it is run again it executes command2
and so on…
Shell Scripts – Shell Script to Toggle Between Two Commands
scripts
scripts
I need help creating a shell script to toggle between two commands.
When it is run command1
is executed then if it is run again it executes command2
and so on…
Best Answer
One good way of accomplishing this is for the script to create a blank "configuration file":
command1
.command2
.command1
.command2
.And so forth.
Here's a script that does that: