3 ms·
You'll probably get more help on stackoverflow... HN isn't really the right venue for specific programming questions :) That being said, you can just use tail
by aeontech 16y ago
You'll probably get more help on stackoverflow... HN isn't really the right venue for specific programming questions :)
That being said, you can just use tail -f as input for your script. Something like this:
tail -f input.txt | encoder.sh &
and have encoder.sh run in a loop reading stdin into a var, encoding the file if var was non-empty and sleeping if it's empty
This is if you are going to be modifying the file while the encoder is running; if the file is static, then sorbus's solution is totally fine.
As for mysql, again, input redirection is your friend.
mysql -u root -D db < dump.sql will run statements in dump.sql against database called db