Vwaju <lou@manhattanhandyman.com> wrote:
[snip]
> Yes, thank you. So somewhere, there is a script that checks to see if
> rc.cups is executable and if it is, runs it. Can you tell me what the
> script is that runs rc.cups? (I tried to write a script with a for-
> loop to grep all the files in rc.d for rc.cups, but my shell
> programming is a little rusty...)
Here's a script that I use:
vvv
#!/bin/sh
# forall
# Copyright (C) 2003, 2004, 2005, 2006, 2007 Joseph Rosevear
# This file is part of an application of SAM for GNU/Linux Slackware
# known as SAM-GLS.
# SAM-GLS is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
# SAM-GLS is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# (Slackware is a registered trademark of Patrick Volkerding and
# Slackware Linux, Inc.)
if [ 1 = `expr 2 \> $#` ]
then
echo Usage: $0 dir cmd [optargs]
exit 1
fi
dir="$1"
shift
find "$dir" -type f -printf "\"%p\" " | xargs "$@"
^^^
Then to use it...
Make it available in your PATH. The traditional way to do that is to
put the script in /usr/local/bin.
Make sure it has useful permissions (do "chmod 755 forall").
Then run it like this:
forall /etc/rc.d grep cups
Or
cd /etc/rc.d
forall . grep cups
The forall script used this way will search all subdirectories too.
This can be very useful when you are looking thru files for something,
and you don't know where it is.
Combine it with less and you have an even more useful search tool:
forall <dir> grep <string> | less
By the way, forall is a part of a SourceForge project which you can
visit at:
https://sourceforge.net/projects/sam-kernel.
-Joe