Using chown in a script
- From: "Gurus Knugum" <gurus.knugum@xxxxxxxxx>
- Date: Sun, 05 Sep 2010 17:02:39 +0200
I copy some files in a script that I run as root (there are other things
in the script that requires root privileges). So the copy of the file now
belongs to root, but I want it to belong to the user, so I figured
something like this:
cp /a/system/file /a/place/in/my/home/directory/
chown -R <Some user>:<Some Group> /a/place/in/my/home/directory/
Running the env command I noticed my username three times:
$USER
$USERNAME
$LOGNAME
Which one should I use for <Some user> above?
For example:
chown -R ${USERNAME}:${USERNAME} /a/place/in/my/home/directory/
I didn't find an environment variable for the groups I belong to, so I
guess I can use the same as for owner, right?
--
Kind regards
Johnny Rosenberg
--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
- Follow-Ups:
- Re: Using chown in a script
- From: James Bensley
- Re: Using chown in a script
- From: Johnny Rosenberg
- Re: Using chown in a script
- Prev by Date: Re: installation question- RESOLVED (probably)
- Next by Date: Re: Using chown in a script
- Previous by thread: Command to scale up CPU?
- Next by thread: Re: Using chown in a script
- Index(es):
Relevant Pages
|