?
Solved

Need a workaround for execdir on system with old find

Posted on 2008-10-09
8
Medium Priority
?
605 Views
Last Modified: 2013-12-16
I need a workaround for execdir on system with an old version of the find command.  Here's the command I tried:

find . -type d -name 'crmngp' -execdir cvs up -C -r DRUPAL-5

How can I replicate that on a system with no execdir support?
0
Comment
Question by:seanr1978
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
8 Comments
 
LVL 48

Expert Comment

by:Tintin
ID: 22682605
find . -type d -name 'crmngp' -exec cvs up -C -r DRUPAL-5 {} \;
0
 

Author Comment

by:seanr1978
ID: 22682631
Fails because it can't find the CVSROOT without first changing to the directory (hence the need for execdir):

cvs update: No CVSROOT specified!  Please use the `-d' option
cvs [update aborted]: or set the CVSROOT environment variable.
0
 

Author Comment

by:seanr1978
ID: 22682639
BTW, if this needs to be done as a perl script or something like that, I'm perfectly OK with that - I just need it to work. ;-)
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 48

Accepted Solution

by:
Tintin earned 2000 total points
ID: 22683144
You could do
#!/bin/bash
here=`pwd`
find . -type d -name 'crmngp' | while read dir
do
  cd $here/$dir
  cvs up -C -r DRUPAL -5
done

Open in new window

0
 

Author Comment

by:seanr1978
ID: 22687301
That generates ": bad interpreter: No such file or directory"
0
 

Author Comment

by:seanr1978
ID: 22687515
Nevermind, figured that one out, and got it to work in a shell script.  Now I'd like to go one further and add it to a function I already had in my .bashrc.  You'll see below that if I call the function as "dg -r crmngp 5", it'll run the first part (based on the code you supplied), print a copy of the find command it uses and it should work through the directories and update them.  The problem, though, is it doesn't ever get into the while part (as if it found no results).  Here's the find command it prints in that echo statement:

find /www/drupal5.ngphost.com -type d -name 'crmngp'

That is correct and there are two copies of crmngp under that directory (one in html/modules and the other in html/new/modules).  Why does it find them when I run that find command normally from the command line but not from within the function in .bashrc?
function dg() {
  if [ "$1" = "-r" ]; then
    here=`pwd`
    echo "find $here -type d -name '$2'"
    find $here -type d -name '$2' | while read dir
    do
      echo "updating $here/$dir"
      cd $here/$dir
      cvs up -C -r DRUPAL-$3
    done
  else
    if [ "$1" = "drupal" ]; then
      if [ -z "$2" ]; then
        cvs -z6 -d:pserver:anonymous:anonymous\@cvs.drupal.org:/cvs/drupal checkout -d ./ drupal;
      else
        cvs -z6 -d:pserver:anonymous:anonymous\@cvs.drupal.org:/cvs/drupal checkout -r DRUPAL-$2 -d ./ drupal;
      fi
    else
      if [ -z "$2" ]; then
        cvs -z6 -d:pserver:anonymous:anonymous\@cvs.drupal.org:/cvs/drupal-contrib checkout -d $1 contributions/modules/$1;
      else
        cvs -z6 -d:pserver:anonymous:anonymous\@cvs.drupal.org:/cvs/drupal-contrib checkout -r DRUPAL-$2 -d $1 contributions/modules/$1;
      fi
    fi
  fi
}

Open in new window

0
 

Author Comment

by:seanr1978
ID: 22688537
Got it with some help in #bash on irc.freenode.net:
function dg() {
  if [ "$1" = "-r" ]; then
    here=`pwd`
    echo "find $here -type d -name '$2'"
    find $here -type d -name "$2" | while read dir
    do
      echo "updating $dir"
      cd $dir
      cvs up -C -r DRUPAL-$3
    done
  else
    if [ "$1" = "drupal" ]; then
      if [ -z "$2" ]; then
        cvs -z6 -d:pserver:anonymous:anonymous\@cvs.drupal.org:/cvs/drupal checkout -d ./ drupal;
      else
        cvs -z6 -d:pserver:anonymous:anonymous\@cvs.drupal.org:/cvs/drupal checkout -r DRUPAL-$2 -d ./ drupal;
      fi
    else
      if [ -z "$2" ]; then
        cvs -z6 -d:pserver:anonymous:anonymous\@cvs.drupal.org:/cvs/drupal-contrib checkout -d $1 contributions/modules/$1;
      else
        cvs -z6 -d:pserver:anonymous:anonymous\@cvs.drupal.org:/cvs/drupal-contrib checkout -r DRUPAL-$2 -d $1 contributions/modules/$1;
      fi
    fi
  fi
}

Open in new window

0
 

Author Closing Comment

by:seanr1978
ID: 31504839
Thank you very much!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question