Is there any way I can create a link, that dynamically updates. My specific situation is, that I have multiple exercises (directories) and I want to link to the latest one:
exercises/ │ exercise_01/ │ │ files ... │ exercise_02/ │ │ files ... │ exercise_03/ │ │ files ... │ exercise_latest/ -> exercise_03/
so if I
cd exercises/exercise_latest it always goes to the latest one.
Adding a new directory
exercise_04 would make the link point to that one instead.
The solutions I can come up with are:
- A cron job that runs once a minute and relinks if it detects a new directory.
- Not make it a link but a script that
cds to the latest directory.
- Manually maintaining it
Neither solution is particularly elegant.
1. is really inefficient and potentially too slow. I cannot copy files into
3. defeats the purpose.
Versioned software releases do something similar.
python3 always links to the latest Python 3 version.
They however probably update every time a new version is installed.
Is there anything I can do that is more elegant than my ideas?