M
Moritz Reiter
Hi,
I am writing a script which uses a configuration file. I already managed
that it is possible for the caller to specify the location of the config
file as a command line parameter (which was pretty easy with optparse).
Now I want to set the default location of for the config file to
/home/username/.my_config_file. Therefore I have to get the username of
the user who is calling the script.
My idea would be to parse /etc/passwd for the return value of
Process.uid but as I am pretty unexperienced in ruby I wanted to ask
here if someone could tell me a more elegant method to do it?
Thanks,
mo
I am writing a script which uses a configuration file. I already managed
that it is possible for the caller to specify the location of the config
file as a command line parameter (which was pretty easy with optparse).
Now I want to set the default location of for the config file to
/home/username/.my_config_file. Therefore I have to get the username of
the user who is calling the script.
My idea would be to parse /etc/passwd for the return value of
Process.uid but as I am pretty unexperienced in ruby I wanted to ask
here if someone could tell me a more elegant method to do it?
Thanks,
mo