[[Sig] How to run SED]
23 Feb 2001 07:07:37 EST
Your snippet of code is attempting to change all the occurances of "nobody:"
to "apache:" inside a bunch of files reprsented by the list ",v". I'm
assuming this is security related since nobody is the default security
principal in apache. Anyway, your guess at running it in a shell with
#!/bin/shell_name was correct, except inside the shell (or at the login shell)
you still have to present it with the list of files. You have at least two
options. First, discover what the list of files is (probably set by a line or
two above in the shell snippet) and then performing either of the following at
the shell prompt:
for f in filename1 filename2 filename3; do sed 's/nobody\:/apache\:/' $f > x;
mv x $f; done
sed 's/nobody\:/apache\:/' filename1 > x; mv x filename1
sed 's/nobody\:/apache\:/' filename2 > x; mv x filename2
sed 's/nobody\:/apache\:/' filename3 > x; mv x filename3
There are other ways to use this "for" construct, but this will probably be
the easiest approach for you.
- - - - - - - - - - - - - - - - - - - -- - - - - - - - -
Randy Kramer <email@example.com> wrote:
> In installing TWiki, they give me the following snippet of code, and say to
use sed to make certain changes.
> The following snippet is presumably either sed, or "bash" code which invokes
sed, but I don't know how to use it.
> I've tried typing it in at the command line (all one line). I've put it in
an executable file, and prefixed it with #!/bin/bash and with #!/bin/sed, and
I've tried it all on one line and putting each piece on a separate line.
> Does anybody know what I need to do?
> The snippet:
> for f in ,v; do sed 's/nobody\:/apache\:/' $f > x; mv x $f; done
> Sig mailing list
Get free email and a permanent address at http://www.netaddress.com/?N=1