I have com across the Situation, that I need to replace all index.php files in direct subdirectories with a symlink to an index php in an repository. This is the structure of my directory.
-
|__ _base
| |__index.php
|
|__ foo.something
| |__ index.php
|
|__ bar.something
|__ index.php
now have to replace the index.php
file in foo.something
and bar.something
with a symlink linking to the index.php
in _base
.
I however have to runn the command as a specific user on the server. So i tried:
runuser -u username <<'EOF'
> for directory in ./*.something; do
> echo $directory
> ln -sf ../_base/index.php ./$directory/index.php
> done
> EOF
However that throws the error "no command found". I may put the commands in a script and execute it with superuser, still I am curious of I just missused runuser, or if there is an other solution as I am fairly new to working with bash.