removing # from crontab (bash script)
Hi All,
I am new to scripting. i am creating a script by which it will check all the enteries in crontab and will remove # if any entry will be commented. Please help me to resolve out. For exp :- $crontab -l #*/10 * * * * ./aa.sh * * * * * ./bb.sh # * * * * * ./cc.sh I want to remove # so that the crontab -l should like this :- */10 * * * * ./aa.sh * * * * * ./bb.sh * * * * * ./cc.sh Please help me. Thanks in advance Inder |
Quote:
|
Read man sed, and add something like sed s/^[[:space:]]*#// where you want to un-comment a line.
Note that sed normally takes a file as input, so something like sed s/^[[:space:]]*#// /etc/crontab > /etc/crontab.new might work. You might also think about removing empty lines and trailing comments. |
Quote:
How can i run this command through a script so that it will reflect all the enteries in crontab ? Thanks Inder |
Quote:
|
All times are GMT -5. The time now is 02:13 AM. |