Bash, Bourne, and nullglob


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bash, Bourne, and nullglob
# 1  
Old 09-21-2010
Bash, Bourne, and nullglob

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 nullglob
But after it starts bash the main script just sits there and does not continue running. If I switch the entire script over to bash shopt -s nullglob works fine but breaks other things that need Bourne. My plan was to exit after needing Bash to go back to Bourne. If I run the lines manually it woks fine, but again does not by running the script itself.

How can I get:
shopt -s nullglob
to work in Bourne or get Bash to do things within the Bourne script?

I am on Solaris 10.

---------- Post updated at 04:36 PM ---------- Previous update was at 02:57 PM ----------

Since no ideas are coming about, I am going to re-write so I don't need nullglob.

Thanks for reading.
# 2  
Old 09-21-2010
You might have waited more than half an hour before giving up. This is a forum, not a live support line. We even have an 'emergency support' forum for time-critical things which you didn't use.

'setopt' might work better than 'shopt' in a shell that's not BASH.
# 3  
Old 09-21-2010
Quote:
Originally Posted by crowman
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

shopt and nullglob are peculiar to bash; they are not available in other shells
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash Vs. Bourne REGEX: metacharacters escaping

I am currently reading a very old reference from O'Reilly: Sed and Awk 2nd Edition reprinted in 2000. So far, it's a solid read and still very relevant. I'd highly recommend this to anyone. The only problem I have with this book is that I had to resort to bourne shell to get my examples to work... (3 Replies)
Discussion started by: ConcealedKnight
3 Replies

2. Shell Programming and Scripting

Confusion about FOR LOOP syntax between Bourne and BASH shell. Please see.

for (( i=1; i<=3; i++ )); do for (( j=1; j<=3; j++ )); do for (( k=1; k<=3; k++ )); do echo $i$j$k done done done Will the above code work on a BOURNE shell? As far as my understanding is, if I am writing the above code in a file..say lol.sh and then running it through the terminal using... (7 Replies)
Discussion started by: navienavnav
7 Replies

3. UNIX for Dummies Questions & Answers

Bourne-sh (not bash) question about nested loops and sed

Here's the input: alpha, numeric or alphanumeric string ("line 1 string") numeric string ("line 2 string") numeric string ("line 3 string") numeric string ("line 4 string") ... where - each numeric string is in a pattern that can be matched with RE but - there can be any number of... (2 Replies)
Discussion started by: uiop44
2 Replies

4. Shell Programming and Scripting

Bourne sh versus bash

Hi All, I know difference between shell(s) we are using, ie. sh, bash etc. But while writing shell script, is there any difference which shell I am using. and if yes, what are they? (4 Replies)
Discussion started by: Deei
4 Replies

5. Shell Programming and Scripting

I need to understand the differences between the bash shell and the Bourne shell

I do not claim to be an expert, but I have done things with scripts that whole teams of folks have said can not be done. Of course they should have said we do not have the intestinal fortitude to git-r-done. I have been using UNIX actually HPUX since 1992. Unfortunately my old computer died and... (7 Replies)
Discussion started by: awk_sed_hello
7 Replies

6. Shell Programming and Scripting

Changing the Bash Scripts to Bourne Scripts:URGENT

Hi, I have to write a program to compute the checksums of files ./script.sh I wrote the program using bash and it took me forever since I am a beginner but it works very well. I'm getting so close to the deadline and I realised today that actually I have to use normal Bourne shell... (3 Replies)
Discussion started by: pgarg1989
3 Replies

7. Shell Programming and Scripting

shopt -s nullglob

Hi, I am using BASH. In a directory there are files that match either of the following 2 patterns: *.L1A_AC* or S*.L1A_MLAC* I would like to write a script that will include a for loop, where for each file in the directory, a certain function will be performed. For example: for FILE in... (4 Replies)
Discussion started by: msb65
4 Replies

8. Shell Programming and Scripting

GREP in Bourne

I have a problem. Suppose I have a log transport.log with the ff: >> tp finished with return code: 203 meaning: wrong syntax in tp call << I'm working on creating a script to find out if there are error are not. Unfortunately, the only way to check if there is error is if the return... (3 Replies)
Discussion started by: kdyzsa
3 Replies

9. Shell Programming and Scripting

bourne script help

I need to make a small script that figures out if a filename that the user enters is a file or a directory. and if it is a directory, how many files are in it. please point me to the right direction, I am a newbie at this. (1 Reply)
Discussion started by: Heedunk
1 Replies

10. UNIX for Dummies Questions & Answers

bourne if, then, else

Hello, A quick, probably dumb question. I'm working on a program and i need to loop through several options. i'm currently doing a bunch of if then else's. i was wondering 2 things in unix (bourne) can i stack else's. 2 would i be better off just using case ie read line if then ... (2 Replies)
Discussion started by: Priest_Ridden
2 Replies
Login or Register to Ask a Question