LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Is it possible to make a "file" that can change its output when accessed? (https://www.linuxquestions.org/questions/linux-general-1/is-it-possible-to-make-a-file-that-can-change-its-output-when-accessed-58932/)

oot 05-09-2003 02:37 PM

Is it possible to make a "file" that can change its output when accessed?
 
I'm trying to get an email program that doesn't have a random signature feature to use random signatures. All it has is a place to specify a single file as the signature file. Specifying a shell script that will output a random signature doesn't work, I just get part of the shell script as my signature.

Is there some way to create something that will, when accessed as if it were a file, be able to generate different output?

Proud 05-09-2003 02:44 PM

Maybe have a cron job run a script which rotates/randomises where a link goes to on your harddrive, and have the email program use the link file as the sig.

david_ross 05-09-2003 02:46 PM

I don't know what client you are using but have you tried things like adding backticks?

MasterC 05-09-2003 02:49 PM

Here's what I do:
Check out:
Boris' Taglines
Then each time the tagline is called it generates a random quote into a .signature file, which is then called by my mail program (kmail) each time. Since the .signature file is randomly created each time the tagline is called, I just have to reference to that for my signature ;)

Cool

oot 05-09-2003 07:06 PM

Thank you everybody!

moses 05-11-2003 08:30 PM

I use pine, which allows pipes:

in ~/.pinerc:
Code:

signature-file=~/.sigproc|
~/.sigproc:
Code:

#!/usr/bin/env sh
echo "--Moses"
echo ""
echo "The Semi-Random Fortune for "`date`" :"
echo ""
fortune



All times are GMT -5. The time now is 10:44 AM.