[ale] Bash scripting q
Geoffrey
lists at serioustechnology.com
Fri May 9 09:26:38 EDT 2008
Geoffrey wrote:
> J. D. wrote:
>> On Thu, May 8, 2008 at 6:42 PM, JK <jknapka at kneuro.net> wrote:
>>
>>> J. D. wrote:
>>>> Is the desired effect for it to expand to /home/callinguser/user?
>>> No, the desired effect is for it to expand to the home
>>> directory of the user name supplied to the script as
>>> arg $1. So if I say:
>>>
>>
>> Oh OK that makes sense. If root is running the script though, isn't the
>> tilde
>> most always going to return the home directory of the calling user root?
>>
>> Using sudo to get the home directory of the target user might be an option.
>>
>> USERHOME=`sudo -u joe pwd`
>
> ~ can be used to display the home directory of other users as follows:
>
> cd ~/billybob
>
> Will put me in billybob's home directory (if I have permissions to go
> there).
>
> ~ is kinda magic in that by itself, it represents your home directory,
> but when it's followed by a '/USERNAME' it represents the home directory
> of USERNAME.
My bad, not enough coffee yet. IF ~ is followed by USERNAME it
represents the home directory of USERNAME...
--
Until later, Geoffrey
Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety.
- Benjamin Franklin
More information about the Ale
mailing list