New answers tagged watch
In bash, you can do this easily using the PROMPT_COMMAND variable (from man bash): PROMPT_COMMAND If set, the value is executed as a command prior to issuing each primary prompt. So, if you add something like this to your ~/.bashrc: PROMPT_COMMAND=". /path/to/file" You will have any variables defined in that file available.
What I eventually want to do is source a file every minute or so to keep certain variables in my bash session up to date. You cannot do that from a child process. You cannot do that from a parent process. You cannot do that from any process other than the one you want it to affect. Changing a process's environment is the same as changing a ...
In your crontab : * * * * * date >> dateFile.txt & sleep 30; date >> dateFile.txt & Straightforward, no ? =) (Better put the full PATH of the date command) Another solution: while true; do date >> dateFile.txt & sleep 30; done
Top 50 recent answers are included