LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-25-2008, 05:40 AM   #16
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63

Your logic is making no sense.

You say if there is no htaccess, the copy only an htaccess.

Then you say, if there is no .htaccess, you want to copy .htaccess *and* htpasswd.

You have two conflicting requirements. The code below lets you do is basically what probably want - you can do something if there is an htaccess file, and something else if there is not. You can run the code below safely - it only echo's what it would do. Remove the echo's when you need it to work.

Code:
find . -type d -exec sh -c 'if test ! -e {}/.htaccess ; then echo cp -i /path/to/.htaccess {}; echo cp -i /path/from/htpass {}/pass; else echo Help Me; fi'  \;
I don't get what where your AuthUserFile grepping comes into this at all.
 
Old 06-25-2008, 09:58 AM   #17
sinister1
Member
 
Registered: Jul 2007
Posts: 70

Original Poster
Rep: Reputation: 15
What i am going to do is:

grep all AuthUserFile within the existing htaccesses. these i am going to rename to .htpasswd.

This way i can run the following commands:

find . -type d -exec sh -c 'test -e {}/.htaccess || cp -i /path/to/.htaccess {}' \;

and then:

find . -type d -exec sh -c 'test -e {}/.htpasswd || cp -i /path/to/.htpasswd {}' \;

This is the quick and dirty solution!

thank you i am gonna try it this way
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash script to put log files into single file and email DragonM15 Programming 13 11-08-2007 03:27 AM
bash ls not coloring files, directories etc mr_smith Red Hat 2 08-30-2006 07:05 AM
.htaccess files doesn't work in home directories rehtorisi Linux - Software 3 08-08-2005 08:02 AM
.htaccess code for blocking CVS directories mrtwice Linux - Software 1 10-12-2004 01:38 PM
Copying linked files, replacing directories in bash scripts? ta0kira Programming 2 10-10-2004 04:46 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration