A symlink has to point to a physical file if you want it to return a file descriptor on open.
So, what you are asking is interesting but does not make sense to me.
Rather than you telling us how to do it, please tell us what you are trying to accomplish.
I am looking for a way to create a symlink which will point to last 1000 lines of a logfile. The link will dynamically point to the last 1000 lines always.
My log file is huge and I am only interested to see what happened recently.
Alias will help to get the last 1000 lines dynamically. I am planning to expose this file using web server for external users to read. In this case will alias be helpful?
Create a named pipe:
mkfifo /tmp/watch_log
Point the tail command to it and background it:
tail -f -n1000 logfile > /tmp/watch_log &
Watch it using the cat command:
cat /tmp/watch_log
Hi, I am wondering if there is a way to create 'conditional symlinks' on a GNU/linux or unix system. I know this has been brought up already several times.. (I wanted to put some links but I dont have 5 posts yet..)
From wikipedia
However I haven't seen any solutions.
I have the "feeling" that it could perhaps be done by creating a special device (like in /dev). However I have no experience creating such devices. For example a small C-program could act as wrapper processing the conditionals, working as pipe stream. For example based on the hostname the stream would point to either file1 or file2, of course more complicated operations are easily possible if this basic example works.
Could someone comment if my hunch makes any sense?