Quantcast
Channel: Using chown $USER:$USER inside bash script - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 6

Answer by Hogcryat for Using chown $USER:$USER inside bash script

$
0
0

The accepted answer by @tim-cutts would not work if you call the script itself with sudo:

sudo ./myscript.sh

A more simple version of this answer would be to use logname:

curuser=$(logname)chown $curuser:$curuser /var/www/$sitename

Viewing all articles
Browse latest Browse all 6

Trending Articles