Page 1 of 1

/root or $HOME? [SOLVED]

Posted: Tue 02 Apr 2013, 10:43
by Argolance
Hello,
/root or $HOME?
Inside a script, are these to paths equivalent or different, for example, has this any importance according to the mode Puppy is running?
Thank you for your attention.

Cordialement.

Re: /root or $HOME?

Posted: Tue 02 Apr 2013, 13:15
by L18L
Argolance wrote:equivalent or different
equivalent if running as root

different if not running as root (---> fido, spot, rex or any other name)
fido's HOME is /root/fido
spot's HOME is /root/spot

I would recommend always $HOME

Posted: Tue 02 Apr 2013, 13:40
by musher0
Salut Argolance.

In addition to L18L's observations, if, in a console, you type :
  • Code: Select all

    rox /mnt/home
    you get the directory where your Puppy system files are located;

    Code: Select all

    rox $HOME
    you get the usual "/root";

    Code: Select all

    rox $home
    you get a listing of the directory from which you issued your command.
I hope this helps.

Bye for now.

musher0

Posted: Tue 02 Apr 2013, 14:18
by darkcity
Can't you use
~/
to point the current 'root/home' directory.

Which means it will work on a Linux that is using non-root login. So maybe ~/ = $HOME ?

Posted: Tue 02 Apr 2013, 15:26
by amigo
'~/' and '$HOME' are equivalent and should always be used instead of any hard-coded path to the users home dir.

Posted: Tue 02 Apr 2013, 18:27
by Argolance
Hello,
Thank you to all of you, "mates"! :wink:

Cordialement.

Posted: Wed 03 Apr 2013, 04:33
by Karl Godt
Am launching xwin via /etc/inittab :

Code: Select all

bash-3.2# echo $HOME
/
It appears that rox uses "$HOME" as well.

Some probably should be /root though :

/root/.packages
/root/.pup_event

Posted: Wed 03 Apr 2013, 08:44
by amigo
At the time that inittab is used, *no* user is logged in. Everything is run effectively as root during init, but root is not logged in. It's called Single User Mode. That's why $HOME evaluates to '/' -the default.