There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Software Development
Tag Cloud
audio blue screen boot bsod computer cpu crash dell desktop driver drivers dvd error excel external hard drive firefox format freezes freezing hard drive hardware hijackthis internet internet explorer ipod itunes laptop malware mouse network networking outlook 2007 power printer problem ram router screen slow sound trojan upgrade usb virus vista vista 32-bit windows windows xp winxp wireless
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Some Bash Scripts Programming Hints


Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
mariolima's Avatar
Junior Member with 24 posts.
 
Join Date: Nov 2002
Location: Sao Paulo - Brazil
08-Sep-2004, 10:03 PM #1
Some Bash Scripts Programming Hints
Hi:

Well, I have to make an update some Bash Scripts, running under one Linux / Apache server. All I need is to perform 6 types of operations in all of them. For the example of the operations I need, let's imagine an httpd.conf file, like this:

<virtualhost 200.157.211.200>
ServerAdmin webmaster@multisitesdominios.com.br
ServerName www.folhadazonanorte.com.br
ServerAlias folhadazonanorte.com.br
DocumentRoot /home/folhadazonanorte/www
ScriptAlias /cgi-bin/ /home/folhadazonanorte/www/cgi-folhadazonanorte/
TransferLog logs/folhadazonanorte-access-log
</virtualhost>

<virtualhost 200.157.211.200>
ServerAdmin webmaster@multisitesdominios.com.br
ServerName www.uncensored.com.br
ServerAlias uncensored.com.br
ServerAlias abcd.com.br
DocumentRoot /home/uncensored/www
ScriptAlias /cgi-bin/ /home/uncensored/www/cgi-uncensored/
TransferLog logs/uncensored-access-log
</virtualhost>

<virtualhost 200.157.211.200>
ServerAdmin webmaster@multisitesdominios.com.br
ServerName www.thorimobiliaria.com.br
ServerAlias thorimobiliaria.com.br
DocumentRoot /home/thorimobiliaria/www
ScriptAlias /cgi-bin/ /home/thorimobiliaria/www/cgi-thorimobiliaria/
TransferLog logs/thorimobiliaria-access-log
</virtualhost>

1) After asking at the prompt, I have the string: "uncensored.com.br". I want to read this file until matching the record where it is "ServerName www.uncensored.com.br". Then delete from <virtualhost 200.157.211.200>, two lines above, until the next <virtualhost 200.157.211.200>. That is, I want to delete the entire Virtualhost block for the domain "uncensored.com.br".

2) In the same way, after asking at the prompt, I have the string "abcd.com.br" and I want to delete just that record "ServerAlias abcd.com.br".

OBS: On these 2 first operations consider I am reading a work version of httpd.conf and writing another work version updated, called, let's say, httpd.conf.updated.

3) On a Bash Script, how to give a prompt message, through echo command, for instance, putting some words in colors, to call attention? Is it possible?

4) On a Bash Script, if I call for execution a command or a program, like, for instance, "rm", "cp", "passwd", and these commands / programs ask something I have to answer, so that the command / program proceed, how to do this?

5) On a Bash Script how to test to see if the user really typed anything after a prompt question by echo command?

6) On a Bash Script how to test if which the user entered is an specific string teh script is waiting for?

Thanks a lot.

Mario./
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 12:05 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.