11-04-2008
The first option should be fine. The list that the for loop will iterate through is only evaluated once, so turning it off in the first invocation of the do ... done part should be safe.
I didn't know about nullglob, thanks for the handy tip!
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