From mint-bounce@lists.fishpool.fi Sat Sep 25 06:28:04 2010 To: From: Peter Slegg Subject: [MiNT] scripting Reply-To: Peter Slegg X-Mailer: MyMAIL Rev:1.94.13761 (Atari/(STiK/STinG/GlueSTiK)) X-Hardware: Atari Milan MIME-Version: 1.0 Date: Sat, 25 Sep 2010 11:25:44 +0200 (GMT) Content-Type: text/plain; charset="iso-8859-1" X-Priority: 3 X-MSMail-Priority: Normal Message-Id: <000d370a.01c73262a0b8@smtp.freeola.net> X-ecartis-version: Ecartis v1.0.0 Sender: mint-bounce@lists.fishpool.fi Errors-to: mint-bounce@lists.fishpool.fi X-original-sender: p.slegg@scubadivers.co.uk Precedence: bulk List-help: List-unsubscribe: List-Id: X-List-ID: List-subscribe: List-owner: List-post: Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.sparemint.org id o8PAS3H5017429 I was experimenting with a script to turn inet services on and off. It's a a lot more complex than stuff I've done before. It seems to work when using a copy of ited.conf in /home but doesn't work when I change FILE to point to /etc/inetd.conf It's run by supplying a services name and on or off eg ./switch.sh ftp on #!/bin/bash -x # echo switch.sh FILE="inetd.conf" # grep $1 $FILE # if [ "$2" = "on" ];then echo Turn $1 on REPL="s/^#"$1"/"$1"/g" else echo Turn $1 off REPL="s/"^$1"/#"$1"/g" fi # find . -name $FILE -type f -exec perl -pi -e $REPL {} \; # grep $1 $FILE I cobbled it together from various internet suggestions, there may be a better way to do this. Peter