shell script babbling
TIL you can combine commands in a pipe that appends extra data to stuff from standard in by wrapping commands in { }
for instance, let's say you need to read the crontab, filter its contents, and also add an extra line
crontab -l | { grep -i "specific-script"; echo "*/10 * * * * /home/user/scripts/specific-script"; } | crontab -
this grabs the contents of your crontab, filters out anything relevant to the script you're adding, then shoves it back into crontab!
shell script babbling
@vahnj I forgot about this but it's so cool
Did you mean -v on grep though? (Also -q just in case that line wasn't in there yet)
shell script babbling
@k yes i forgot those woops
shell script babbling
god damn this is useful. i wish i knew this a long time ago