-1

What am I doing wrong?

for filename in /home/darragh/public_html/test/*
do
 sed -i 's/..\/config/.\/config/g'
done;

It just gives me: sed: No input files

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by sknake
0

Forgetting to give the filename to sed:

for filename in /home/darragh/public_html/test/*
do
 sed -i 's/..\/config/.\/config/g' ${filename}
done;
0

Okay that is probably right, but now it says I don't have permission, which is right because I made those files as root, but if I do sudo for ... then it says unknown command for...

What to do know?

0

Run the script as root or modify your script. 'for' is just a bash command for looping what you need elevated privelages for is possibly the 'ls' and the sed:

for filename in `sudo /home/darragh/public_html/test/*`
do
 sudo sed -i 's/..\/config/.\/config/g' ${filename}
done;
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.