Hi, in my ubuntu lucid box, I have a bash script to automatize the creation of a svn repository (this is not a svn question).
In the script, I have these lines of code (among others):
Code:
# Create the repository
sudo -u www-data svnadmin create --fs-type fsfs $PATH$1 2>&1
# Create a pre-commit hook manually
sudo -u www-data echo '#!/bin/sh
REPOS="$1"
TXN="$2"
...some more content' > $PATH$1/hooks/pre-commit
Ok, the second sentence (sudo -u www-data echo ...) cannot complete because it shows a "permission denied" even though the $PATH$1/hooks is owned by www-data:www-data.
Interesting thing is that if I remove the "sudo -u www-data" from the script, and I execute it "outside" as: sudo -u www-data ./createrepo nameofrepo, no more "permission denied" errors are showed.
How can I achieve this "sudo -u www-data" inside the script?
Thanks in advance.
Cheers,
Roland
Bookmarks