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

Correction to the script wcleanMachine

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

Reply
 
LinkBack Thread Tools Display Modes
Old   June 10, 2008, 07:30
Default Hello, I would like to prop
  #1
Senior Member
 
Martin Beaudoin
Join Date: Mar 2009
Posts: 330
Rep Power: 13
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, 10:21
Default Thanks for the suggestion, I h
  #2
Senior Member
 
Join Date: Mar 2009
Posts: 854
Rep Power: 13
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, 13:05
Default Thanks Henry, Please take n
  #3
Senior Member
 
Martin Beaudoin
Join Date: Mar 2009
Posts: 330
Rep Power: 13
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, 14:18
Default Yes I noticed the error and co
  #4
Senior Member
 
Join Date: Mar 2009
Posts: 854
Rep Power: 13
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, 15:38
Default Indeed, according to the man p
  #5
Senior Member
 
Martin Beaudoin
Join Date: Mar 2009
Posts: 330
Rep Power: 13
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
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 On
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 NUMECA 2 October 5, 2007 01:44
awk script question awk script question Main CFD Forum 0 March 28, 2005 02:06
Kill Script DAE FLUENT 3 March 31, 2003 04:43
linking the script Mavinakere FLUENT 0 September 12, 2002 11:57


All times are GMT -4. The time now is 05:19.