Check These Out
Each shell function has its own summary line, as a comment. If there are multiple shell functions with the same name, the function with the highest number of votes is put into the file.
Note: added 'grep -v' to the end of the pipeline, to eliminate extraneous lines containing only '--'. Thanks to matthewbauer for pointing this out.
watch is a command especially designed for doing this job
host B (you) redirects a modem port (62220) to his local ssh.
host A is a remote machine (the ones that issues the ssh cmd).
once connected port 5497 is in listening mode on host B.
host B just do a
ssh 127.0.0.1 -p 5497 -l user
and reaches the remote host'ssh. This can be used also for vnc and so on.
the block of the loop is useful whenever you have huge junks of similar jobs, e.g., convert high res images to thumbnails, and make usage out of all the SMP power on your compute box without flooding the system.
note: c is used as counter and the random sleep
$ r=`echo $RANDOM%5 |bc`; echo "sleep $r"; sleep $r
is just used as a dummy command.
It is a pain grep-ing/sed-ing/awk-ing plain old df. POSIX it!
This script will run each time you boot up.The script must be in /etc/init.d directory.
I learned a few things reading this command. But I did run into a few issues:
1. On systems that don't use GNU echo (e.g. macOS 10.14.5 Mojave), the e option may not be supported. In this case ANSI escape codes will echoed as text and the terminal will not flash, like this:
\e[?5h\e[38;5;1m A L E R T Thu Jun 20 16:31:29 PDT 2019
2. Since the read command strips\ignores leading backslashes, if a user types the backslash character once in the loop, it will not break. Typing backslash twice in a loop will break as expected.
3. The foreground color is set to red (\e[38;5;1m) on every loop. This could be set once before we call while, and then reset once when the loop breaks.
4. Instead of resetting the foreground color when it breaks, the video mode is set back to normal (\e[?5l). This has the effect of leaving the terminal text red until it is manually reset.
The alternative I'm proposing here addresses these issues. I tested it on macOS and Arch Linux.
Even adds a newline.
Or "tail -r" on Solaris.