I notice a usage of crontab
crontab -
If I echo some content in this command, it is able to overwrite the cron content, e.g.,
$ crontab -l
...
# m h dom mon dow command
* * * * * /bin/ls
$ crontab -l | sed 's/ls/cd/g' | crontab -
$ crontab -l
...
# m h dom mon dow command
* * * * * /bin/cd
Question: What does '-' mean in bash? Is '-' something generic in bash?
-
is not specific to bash. It is a convention used with many unix programs as a file to mean "stdin" (for input) or "stdout" (for output).
In this case, crontab
normally takes a parameter that is the filename to read and load as the new cron content. Instead, passing -
means "take the content from standard input".