Is there a way to run a command repeatedly?

Is there a way to run a command repeatedly?

I agree with commenter @reuben, that you possible should look for other options (including getting that coworker himself “fixed”), but anyway here is a way to run the command repeatedly: Note that this might still leave a window, where it cannot cancel a shutdown because it is not “fast” enough.

How to test the exit status of a command?

You need to test $? instead, which is the exit status of the previous command. passwd exits with 0 if everything worked ok, and non-zero if the passwd change failed (wrong password, password mismatch, etc…) With your backtick version, you’re comparing passwd’s output, which would be stuff like Enter password and confirm password and the like.

What happens if you run csrss.exe twice?

Also it causes “mild terror” to your system, at least on the csrss.exe (or conhost.exe) process, because the console window will be busy printing messages. Thus you might want to redirect the output at least ( shutdown -a > NUL 2>&1) and/or introduce some delay beteween the calls to shutdown.

How to repeat a command every 5 seconds?

% repeat -1 5 echo “This will get echoed every 5 seconds forever.” Try the watch command. will run the command every second (well, technically, every one second plus the time it takes for command to run as watch (at least the procps and busybox implementations) just sleeps one second in between two runs of command ), forever.

Is it possible to have a command repeat automatically in Linux?

Repeat command automatically in Linux Ask Question Asked8 years, 7 months ago Active6 months ago Viewed324k times 314 80 Is it possible in Linux command line to have a command repeat every nseconds? Say, I have an import running, and I am doing ls -l to check if the file size is increasing.

How to run a Linux command every x seconds forever?

How to Run or Repeat a Linux Command Every X Seconds Forever 1 Use watch Command Watch is a Linux command that allows you to execute a command or program periodically and also… 2 Use sleep Command More