On 26/08/2015 2:12 AM, Sean Crosby wrote:
> I have a need for a way for a regular user (i.e. non root) to "override"
> a file on a filesystem with one of their own, but just for the lifetime
> of a script.
> 
> I'll give you an example.
> 
> One of my users runs a program which is distributed in a package (i.e.
> not changeable by them). That program is looking for a file,
> /path1/file1. My user would like to change this file to a different
> version of the file in different scripts.
> 
> I'm not aware of one, but is there a way to redirect file open calls for
> /path1/file1 to /path2/file2 in a script? It only has to be for file
> open/read calls, and not write. The /path1 filesystem is not writeable
> by the user.

How about something as simple as this:

if [ -f /path2/file2 ]
then
        FILEX=/path2/file2
else
        FILEX=/path1/file1
fi

If /path2/file2 is too, errr variable, then perhaps an environment
variable or a passed parameter?


Cheers
A.
_______________________________________________
luv-main mailing list
[email protected]
http://lists.luv.asn.au/listinfo/luv-main

Reply via email to