My problem is like this (OS is Sun Solaris):
-
At the boot time I want to start a process using a specific script. I am doing this by putting this script in
/etc/init.d(and following other K and S rules). -
The program which will be called by the script is located at
$HOME/xxx/yyylocation. -
I am using
'su - {myuser} -c "{full path of the program}"'in order to execute the script as {myuser}. -
I don’t want to hardcode the value of $HOME in the script, but I want to use the
$HOMEenvironment variable only. How can I get this$HOMEenvironment variable in the shell script? Also what other variables will be available to me?
To get the home variable of any user, try this hack: