CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Bugs

Correction to the script wcleanMachine

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 10, 2008, 08:30
Default Hello, I would like to prop
  #1
Senior Member
 
Martin Beaudoin
Join Date: Mar 2009
Posts: 332
Rep Power: 22
mbeaudoin will become famous soon enough
Hello,

I would like to propose a small correction to the script wcleanMachine in order to correctly cleanup the Make directory under src/Pstream/mpi.

With the actual current version of wcleanMachine, the clean-up is not made properly under src/Pstream/mpi/ because the script only looks for an exact machine pattern under the Make directory, which usually is $WM_OPTIONS.

But under src/Pstream/mpi, we usually end up with directory names like this:

Make/$(WM_OPTIONS)MPI or
Make/$(WM_OPTIONS)LAM or
Make/$(WM_OPTIONS)OPENMPI

and wcleanMachine fails to remove those.

So I would like to propose this little modification to the script wcleanMachine in order to handle this cleanup problem:


# find `find . -depth \( -name "Make.[A-Za-z]*" -o -name "Make" \) -type d -print` -depth \( -type d -name "*$1" \) -exec rm -r {
\; # <---- old version}
find `find . -depth \( -name "Make.[A-Za-z]*" -o -name "Make" \) -type d -print` -depth \( -type d -regex ".*$1\|.*$1$WM_MPLIB" \) -exec rm -r { \;}


Martin
mbeaudoin is offline   Reply With Quote

Old   June 10, 2008, 11:21
Default Thanks for the suggestion, I h
  #2
Senior Member
 
Join Date: Mar 2009
Posts: 854
Rep Power: 22
henry is on a distinguished road
Thanks for the suggestion, I have put it in 1.5

Henry
henry is offline   Reply With Quote

Old   June 10, 2008, 14:05
Default Thanks Henry, Please take n
  #3
Senior Member
 
Martin Beaudoin
Join Date: Mar 2009
Posts: 332
Rep Power: 22
mbeaudoin will become famous soon enough
Thanks Henry,

Please take note that I messed up the braces syntax of the last part of the find command while playing with the Forum Message formatting language.

Here are the two lines again, but without any formatting:

#find `find . -depth \( -name "Make.[A-Za-z]*" -o -name "Make" \) -type d -print` -depth \( -type d -name "*$1" \) -exec rm -r {} \;
find `find . -depth \( -name "Make.[A-Za-z]*" -o -name "Make" \) -type d -print` -depth \( -type d -regex ".*$1\|.*$1$WM_MPLIB" \) -exec rm -r {} \;

Sorry about that,

and thanks to Bernhard for pointing that one out.

Martin
mbeaudoin is offline   Reply With Quote

Old   June 10, 2008, 15:18
Default Yes I noticed the error and co
  #4
Senior Member
 
Join Date: Mar 2009
Posts: 854
Rep Power: 22
henry is on a distinguished road
Yes I noticed the error and corrected it. I also changed the -regex to -name ... -o ... as I am not sur we can rely on all implementations of find support -regex.

H
henry is offline   Reply With Quote

Old   June 10, 2008, 16:38
Default Indeed, according to the man p
  #5
Senior Member
 
Martin Beaudoin
Join Date: Mar 2009
Posts: 332
Rep Power: 22
mbeaudoin will become famous soon enough
Indeed, according to the man page, "-name" and "-o" are specified in the POSIX standard, which should be more portable.

Thanks for the tip!

Martin
mbeaudoin is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ICEM SCRIPT bhaskar CFX 0 January 3, 2009 05:49
Error in Tcl script Haider Fidelity CFD 2 October 5, 2007 02:44
awk script question awk script question Main CFD Forum 0 March 28, 2005 03:06
Kill Script DAE FLUENT 3 March 31, 2003 05:43
linking the script Mavinakere FLUENT 0 September 12, 2002 12:57


All times are GMT -4. The time now is 00:53.