09-22-2008
Loop problem with one more problem
Hi ALL
I am greping some thing from a file,some thing is "/var/www/html" /var/www"/example" and so on its showing like this when u use echo.i want to pass each one of them in a loop for processing.Like start with /var/www/html then 2nd and so one
But that not working any iead how i give one by one value.
My code
docroot=$(grep -H DocumentRoot /etc/httpd/conf.d/*.conf | awk -F' ' '{ print $3 }'| sort -u | uniq)
doccount=$(grep -H DocumentRoot /etc/httpd/conf.d/*.conf | awk -F' ' '{ print $3 }'| sort -u | uniq | wc -l)
for (( i=0; i <= $doccount; ++i ))
do
confd="$docroot\n"
echo $confd
find $confd -type d -perm /o=w | while read DIR
do
do some thing
done ## while done
done ##for done
10 More Discussions You Might Find Interesting
1. Programming
hi all,
i have written the following code:
while(proceed !='Y' && proceed!='N' && proceed!='y' && proceed!='n')
{
printf("\nPress \n\t 'Y' or 'y' to continue \n\t 'N' or 'n' to cancel:");
scanf("%c",&proceed);
}
the output i am gettin is:
Press
'Y' to continue
... (1 Reply)
Discussion started by: mridula
1 Replies
2. Shell Programming and Scripting
Got a problem with a loop that do this for each line:
a=$(( cost + $( awk ' { print $2 } ' file) ))
awk ' $2 ~ "^" && $2 > 0 {$2='$a';print} ' file
#!/bin/sh
cost=30
for, until, while?
do
"db update OD_LINK_COST something"
done
For troubleshoot the file looks like this
55 10
56 ... (1 Reply)
Discussion started by: maskot
1 Replies
3. Shell Programming and Scripting
Hi,
I faced a problem when I try to populate a database using the following script
DECLARE
a NUMBER := 1;
b NUMBER := 91317010001;
c NUMBER := 1;
BEGIN
WHILE a < 5001 LOOP
insert into RGC_IMS_REGISTRATION (IMSRegId, Type, IMPI, IMPU, CP_ID, Location_For_Registration,... (1 Reply)
Discussion started by: sukumarm2008
1 Replies
4. Shell Programming and Scripting
hi guys,
i have a simple if loop as follows:
if } -lt ${ARRAY}]; then
echo "alert!!"
fi
when i run it, i get command not found error..i sat and stared at it for hours.. what is wrong with it? (3 Replies)
Discussion started by: npatwardhan
3 Replies
5. Shell Programming and Scripting
osname=`uname`
if || || ; then
echo "hi"
fi
its saying
bash: [: too many arguments
why?
anybody knows? (4 Replies)
Discussion started by: crackthehit007
4 Replies
6. UNIX for Advanced & Expert Users
Hi guys my while do loop is not working properly;
As soon as the load_date and run_date is same it should stop can somebody tell me where I am having the problem?
In an oracle table I have
LOAD_DT=5/1/2009 DATE datatype
RUN_DT=5/5/2009 DATE datatype
Now in a script with a spool file I get the... (15 Replies)
Discussion started by: henrysmith
15 Replies
7. Shell Programming and Scripting
Hi
What is wrong with this loop
it was taken has a example in book!!!
it returns
then
/usr/sbin/svcadm disable ppserv
else /usr/sbin/ppadmin stop
fi
} (3 Replies)
Discussion started by: Ex-Capsa
3 Replies
8. Programming
Hello friends,
Please have a look at this code, and then i will tell you the problem.
int main()
{
int i = 0;
int cont = 1;
while( cont == 1 )
{
printf( "Enter i\n" );
scanf( "%d", &i );
switch( i )
{
... (5 Replies)
Discussion started by: gabam
5 Replies
9. Shell Programming and Scripting
I am trying to do a while do loop that asks for a password and returns if the password entered is incorrect. I have that part working however i want to modify it so that if a similar word is entered it will read "that is close but incorrect" and i cannot seem to get it working, being new in the... (6 Replies)
Discussion started by: lm5522
6 Replies
10. Shell Programming and Scripting
Hi all,
a problem with a loop. Imagine it starts with
var1="$(cat txtif.out )"while
do
echo file1
echo file2
echo y > txtif.out
if
then
break
fi
done
exit 0
the problem is that if the file is changing during the loop seems to continue as it reads "x" state,... (5 Replies)
Discussion started by: Board27
5 Replies
LEARN ABOUT DEBIAN
catalyst::engine::apache2::mp20
Catalyst::Engine::Apache2::MP20(3pm) User Contributed Perl Documentation Catalyst::Engine::Apache2::MP20(3pm)
NAME
Catalyst::Engine::Apache2::MP20 - Catalyst Apache2 mod_perl 2.x Engine
SYNOPSIS
# Set up your Catalyst app as a mod_perl 2.x application in httpd.conf
PerlSwitches -I/var/www/MyApp/lib
# Preload your entire application
PerlModule MyApp
<VirtualHost *>
ServerName myapp.hostname.com
DocumentRoot /var/www/MyApp/root
<Location />
SetHandler modperl
PerlResponseHandler MyApp
</Location>
# you can also run your app in any non-root location
<Location /some/other/path>
SetHandler perl-script
PerlResponseHandler MyApp
</Location>
# Make sure to let Apache handle your static files
# (It is not necessary to remove the Static::Simple plugin
# in production; Apache will bypass Static::Simple if
# configured in this way)
<Location /static>
SetHandler default-handler
</Location>
# If not running at a root location in a VirtualHost,
# you'll probably need to set an Alias to the location
# of your static files, and allow access to this location:
Alias /myapp/static /filesystem/path/to/MyApp/root/static
<Directory /filesystem/path/to/MyApp/root/static>
allow from all
</Directory>
<Location /myapp/static>
SetHandler default-handler
</Location>
</VirtualHost>
DESCRIPTION
This is the Catalyst engine specialized for Apache2 mod_perl version 2.x.
ModPerl::Registry
While this method is not recommended, you can also run your Catalyst application via a ModPerl::Registry script.
httpd.conf:
PerlModule ModPerl::Registry
Alias / /var/www/MyApp/script/myapp_registry.pl/
<Directory /var/www/MyApp/script>
Options +ExecCGI
</Directory>
<Location />
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
</Location>
script/myapp_registry.pl (you will need to create this):
#!/usr/bin/perl
use strict;
use warnings;
use MyApp;
MyApp->handle_request( Apache2::RequestUtil->request );
METHODS
ok_constant
OVERLOADED METHODS
This class overloads some methods from "Catalyst::Engine".
unescape_uri
OVERLOADED METHODS
This class overloads some methods from "Catalyst::Engine".
unescape_uri
SEE ALSO
Catalyst, Catalyst::Engine, Catalyst::Engine::Apache2.
AUTHORS
o Sebastian Riedel <sri@cpan.org>
o Christian Hansen <ch@ngmedia.com>
o Andy Grundman <andy@hybridized.org>
o Tomas Doran <bobtfish@bobtfish.net>
COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by The "AUTHORS".
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.10.1 2010-11-26 Catalyst::Engine::Apache2::MP20(3pm)