This commit is contained in:
audy 2023-06-29 07:07:57 -06:00
commit fe1749b4aa
4 changed files with 35 additions and 0 deletions

24
README.txt Normal file
View File

@ -0,0 +1,24 @@
simple tool to repeat a shell command automatically
detailed behavior:
clear the screen, execute [command], wait 0.1 seconds, repeat. exit immediatly on strong break.
usage:
repeat [command]
note: if the [command] has spaces in it (for example - passing parameters to the program), remember to surround it with quotes
example:
repeat date
repeat the date command, so you will have a terminal with the date at the top left
repeat "ls -l"
repeatedly list all of the files in the working directory, to see if a new one appears, or the access time changes
repeat ./repeat
uh oh
todo:
define behavior for repeat without options
take command line input for time to wait before repeating
clean exit
style this page like a man page (im not gonna make it an actual man page though, because this is just a few lines of c in one executable)

BIN
repeat Executable file

Binary file not shown.

11
repeat.c Normal file
View File

@ -0,0 +1,11 @@
#include <stdio.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
while(1) {
system("clear");
system(argv[1]);
usleep(100000); //0.1 second
}
exit(0);
}

BIN
repeat.o Normal file

Binary file not shown.