Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
openfoam
Commits
d8a812ce
Commit
d8a812ce
authored
14 years ago
by
Mark Olesen
Browse files
Options
Downloads
Patches
Plain Diff
ENH: add '-all' option to foamEtcFile for similar results as findEtcFiles
parent
6c9dacd2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/foamEtcFile
+24
-12
24 additions, 12 deletions
bin/foamEtcFile
with
24 additions
and
12 deletions
bin/foamEtcFile
+
24
−
12
View file @
d8a812ce
...
...
@@ -44,7 +44,7 @@
#
#-------------------------------------------------------------------------------
usage
()
{
[
"
${
quietOpt
:-
$s
ilent
Opt
}
"
=
true
]
&&
exit
1
[
"
${
optQuiet
:-
$optS
ilent
}
"
=
true
]
&&
exit
1
exec
1>&2
while
[
"$#"
-ge
1
]
;
do
echo
"
$1
"
;
shift
;
done
...
...
@@ -53,6 +53,7 @@ usage() {
Usage:
${
0
##*/
}
[OPTION] fileName
${
0
##*/
}
[OPTION] -list
options:
-all return all files (otherwise stop after the first match)
-list list the directories to be searched
-mode <mode> any combination of u(user), g(group), o(other)
-prefix <dir> specify an alternative installation prefix
...
...
@@ -129,7 +130,7 @@ esac
# default mode is 'ugo'
mode
=
ugo
unset
listOpt quietOpt s
ilent
Opt
unset
optAll optList optQuiet optS
ilent
# parse options
while
[
"$#"
-gt
0
]
...
...
@@ -138,8 +139,11 @@ do
-h
|
-help
)
usage
;;
-a
|
-all
)
optAll
=
true
;;
-l
|
-list
)
listOp
t
=
true
optLis
t
=
true
;;
-m
|
-mode
)
[
"$#"
-ge
2
]
||
usage
"'
$1
' option requires an argument"
...
...
@@ -161,10 +165,10 @@ do
shift
;;
-q
|
-quiet
)
quietOp
t
=
true
optQuie
t
=
true
;;
-s
|
-silent
)
s
ilent
Opt
=
true
optS
ilent
=
true
;;
-v
|
-version
)
[
"$#"
-ge
2
]
||
usage
"'
$1
' option requires an argument"
...
...
@@ -239,14 +243,15 @@ set -- $dirList
# The main routine
#
if
[
"
$listOpt
"
=
true
]
exitCode
=
0
if
[
"
$optList
"
=
true
]
then
# list directories, or potential file locations
[
"
$nArgs
"
-le
1
]
||
usage
# a silly combination, but -quiet does have precedence
[
"
$
quietOp
t
"
=
true
]
&&
exit
0
[
"
$
optQuie
t
"
=
true
]
&&
exit
0
for
dir
do
...
...
@@ -257,25 +262,32 @@ then
echo
"
$dir
"
fi
done
exit
0
else
[
"
$nArgs
"
-eq
1
]
||
usage
# general error, eg file not found
exitCode
=
2
for
dir
do
if
[
-f
"
$dir
/
$fileName
"
]
then
[
"
$quietOpt
"
=
true
]
||
echo
"
$dir
/
$fileName
"
exit
0
exitCode
=
0
if
[
"
$optQuiet
"
=
true
]
then
break
else
echo
"
$dir
/
$fileName
"
[
"
$optAll
"
=
true
]
||
break
fi
fi
done
fi
# general error, eg file not found
exit
2
exit
$exitCode
#------------------------------------------------------------------------------
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment