$FILES=`find /release/ext -name *stores*. Dat` for FILE in $FILES do # need to test for empty, case $FILES is empty test -n "$FILE" && /do/whatever/you/want done.
1 He said he didn't want the search to be recursive. This snippet will break on files with spaces. I don't know if SunOS 5.10 find supports -maxdepth.
– jordanm Jan 7 at 14:35 @jordanm OQ examples show no spaces. If subdirectories exist (not in OQ) you can use something like test -n "$FILE" && test `dirname "$FILE"` == "/release/ext" && /do/what/you/want if you don't have maxdepth – Eugen Rieck Jan 7 at 14:40 There is no need to handle spaces in filenames. But does there have to be a separate loop for 'stores','hr'.
Etc? And can the other arguments stay next to the filename? – toop Jan 7 at 14:48 You can use $ALLFILES="*stores*.
Dat hr*. Dat *emp*. Txt"; for FILES in $ALLFILES ... .
Arguments are meant to be part of /do/whatever/you/want – Eugen Rieck Jan 7 at 14:52 You don't need a subshell to get dirname. "${FILE%/*}" will give you the same result as dirname. Also you can use the bash keyword instead of test, which will imply -n.
$FILE && ... – jordanm Jan 7 at 14:52.
It is unclear what the pipe characters and numbers are for in your $FILES variable. However, here is something you might find useful: #! /bin/bash filespecs='*stores*.
Dat *hr*. Dat *emp*. Txt' dir='/release/ext' cd "$dir" for file in $filespecs do sh myexternalscript.Sh "$dir/$file" done Note that your question is tagged "bash" and you use "bash" in your shebang, but for some reason, you use "sh" when you call your other script.
On some systems, sh is symlinked to Bash, but it will behave differently than Bash when called directly. On many systems, sh is completely separate from Bash.In order to expand the globs and incorporate other arguments, you will need to violate the Bash rule of always quoting variables (this is an example of one of the exceptions). Filespecs='*stores*.
Dat | 3 *hr*. Dat 4 5 *emp*. Txt 6 7 8' while read -r spec arg1 arg2 arg3 arg4 do sh myexternalscript.
Sh "$dir"/$spec "$arg1" "$arg2" "$arg3" "$arg4" done Extras will be passed as empty, but set arguments. If there are more arguments than variables to accept them, then the last variable will contain all the remainders in addition to the one that corresponds to it. This version doesn't need the cd since the glob isn't expanded until the directory has been prepended, while in the first version the glob is expanded before the directory is prepended.
If you quote the pipes in the manner shown in your question, then the double quotes will be included in the argument. In the way I show it, only the pipe character gets passed but it's protected since the variable is quoted at the time it's referenced.
The pipe characters and numbers in the $FILES variable are arguments accepted by the myexternalscript. Sh script as it does not just take the filename as an argument. I tried your script but it did not work and just passed the literal stores.
Dat as an argument. – toop Jan 7 at 23:32 @toop: I omitted a cd command which was necessary in order to make it work. I added that, plus I added another version that should allow you to include your arguments.
I'm certain there's a better way to do this, but I would need to see how your arguments are being derived for the "outer" script (if they're not hard-coded) and probably need to see how they're being consumed in the "inner" script. – Dennis Williamson Jan 8 at 2:08.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.