11-04-2008
Quote:
Originally Posted by
msb65
Hi cfajohnson,
- I appreciate the response. Could you please expand on your statement that shopt -s nullglob is not standard? What do you mean exactly?
It only works in bash.
Quote:
- Also, is the purpose of the code that you have written inside the for loop to eliminate the error message that occurs when one of the patterns is not matched?
Exactly. It acheives the same effect as shopt -s nullglob, but will work in all Bourne-type shells.
3 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I am using bash shell's extended pattern matching.
What tweak the following code needs in order to get the expected output?
shopt -s extglob
f="a@b@_c@d@_e"
echo "${f/@(@|@_)/__}"
My expected output is:
a__b__c__d__e
but the actual output is:
a__b@_c@d@_e
# that is, how to... (3 Replies)
Discussion started by: royalibrahim
3 Replies
2. Shell Programming and Scripting
I have a script that start out with this:
#!/sbin/sh
Several things run.
However I cannot get:
shopt -s nullglob
to run in Bourne. I get:
shopt: not found
So within the main script (after #!/sbin/sh at the top) I start bash with:
bash
and try to run what I need with:
shopt -s... (2 Replies)
Discussion started by: crowman
2 Replies
3. UNIX for Advanced & Expert Users
What is the point of this? Whenever I close my shell it appends to the history file without adding this. I have never seen it overwrite my history file.
# When the shell exits, append to the history file instead of overwriting it
shopt -s histappend (3 Replies)
Discussion started by: cokedude
3 Replies