Changing the Bash Scripts to Bourne Scripts:URGENT


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Changing the Bash Scripts to Bourne Scripts:URGENT
# 1  
Old 08-30-2009
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 (bin/sh) and not bash(bin/bash).

Could anyone PLEASE help me to adjust my script (like replacing arrays..) I'm just getting so desperate....

I just attach a file with the script and to run the script.

PLEASE HELP me anyone! Thank you so much!
# 2  
Old 08-30-2009
Hi.

On my (Linux) system, they are the same:

Code:
> ll $(which sh)
lrwxrwxrwx 1 root root 4 Feb  9  2008 /bin/sh -> bash

/bin > ./sh
/bin > echo $0
sh
/bin > $0 --version
GNU bash, version 3.1.17(1)-release (i686-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

Check this on your system.

If they're not the same, change the "shebang" on the first line:

i.e.
Code:
#!/bin/sh

and run the script (possibly with -n) to check the syntax and see where the errors are.

I found this link (from cfjohnson) about how to "simulate arrays" in shells which don't support them:

http://unix.derkeiler.com/Newsgroups...4-05/0052.html

Last edited by Scott; 08-30-2009 at 11:30 AM..
# 3  
Old 08-30-2009
Changing the Bash Scripts to Bourne Scripts:URGENT

Hi
Thank You for your email.
As you said me i tried it, but it didn't work for me. well the script is in proper Bash shell. I want it in Bourne Script. It is showing me some of the errors.

Looking for your reply soon.
Thanks.

------------------------------------------------------------------------------------
Quote:
Originally Posted by scottn
Hi.

On my (Linux) system, they are the same:

Code:
> ll $(which sh)
lrwxrwxrwx 1 root root 4 Feb  9  2008 /bin/sh -> bash

/bin > ./sh
/bin > echo $0
sh
/bin > $0 --version
GNU bash, version 3.1.17(1)-release (i686-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

Check this on your system.

If they're not the same, change the "shebang" on the first line:

i.e.
Code:
#!/bin/sh

and run the script (possibly with -n) to check the syntax and see where the errors are.

No-one here, I think, really wants to trawl through your rather long script and do all this for you.
# 4  
Old 08-30-2009
Hi.

I updated my post with a link that might help. As SH doesn't support arrays, you need to work around it, and eval is a good solution.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

KSH - How to call different scripts from master scripts based on a column in an Oracle table

Dear Members, I have a table REQUESTS in Oracle which has an attribute REQUEST_ACTION. The entries in REQUEST_ACTION are like, ME, MD, ND, NE etc. I would like to create a script which will will call other scripts based on the request action. Can we directly read from the REQUEST_ACTION... (2 Replies)
Discussion started by: Yoodit
2 Replies

2. AIX

Please update inittab/rc.shutdown/rc scripts to start/stop mqm (need help Urgent)

HI i need help from seniors on this issue, i need to know how to do this, i need to update 50+ server starting saturday. below is the ticket which i have with full description. Currently MQ Series must be stopped before and started after any reboot. Not having the start/stop as part of... (2 Replies)
Discussion started by: gulamibrahim
2 Replies

3. UNIX for Dummies Questions & Answers

Cron changing folder for scripts

I would like to ask if cron when running a planned script changes the current folder for the script. Thank you! (2 Replies)
Discussion started by: MartyIX
2 Replies

4. Fedora

I need urgent help - Basic shell scripts but I'm clueless.

Hello. I am currently in a class dealing with shell scripts. I know some commands and get the basics of command line in Fedora 11. But the coding....I'm a bit lost. I was very ill for 2 weeks and missed a lot, much of which there are no notes provided. I'm not asking you to do my homework,... (1 Reply)
Discussion started by: Feuyaer
1 Replies

5. UNIX for Dummies Questions & Answers

changing scripts in /etc/rc2.d

This is a newbie question in which I feel almost ashamed in asking lol. I am told to make changes to /etc/rc2.d so that only certain scripts run. If I change something like S05netconfig to s05netconfig will it still run? What is the difference between S and s scripts (I see both types in there).... (1 Reply)
Discussion started by: rkruck
1 Replies

6. UNIX for Dummies Questions & Answers

Scripts and changing users

Hi, I am writing somescripts to shut down some services in Korn Shell. Some of the services are under different owners. For example when I want to shutdown NXserver I need to be "root", but when I shut down the webserver I need to be under a different user. Manual I would use "su root" and... (1 Reply)
Discussion started by: bonekrusher
1 Replies

7. Shell Programming and Scripting

how to log if the program contains both bourne-shell & pearl scripts

I have a program (say, MyProgram) written in Bourne-shell script, but at some point it calls another script written in pearl, as illustrated below: #!/bin/sh ..... case $x in 1) ConfigSystem1 ( b-shell script) 2) ConfigSystem2 ( pl) 3) ConfigSystem3 (b-shell) .... Then I create... (0 Replies)
Discussion started by: bluemoon1
0 Replies

8. AIX

Examples of writing shell scripts for AIX, it's urgent

Please help me 1. Please give me the few examples of shell scripts written for AIX 2.I have scripts written on Unix, does that work for AIX, if not what are the changes to be carried out to run the scripts on AIX.... Please help me (4 Replies)
Discussion started by: me_haroon
4 Replies

9. UNIX for Dummies Questions & Answers

changing permission using scripts

I have been trying to create a script that changes the user rights to read in the 'other' group across directories. The problem I'm having is that when i execute the script, the permissions of the directories remains the same. HELP (8 Replies)
Discussion started by: BigTool4u2
8 Replies
Login or Register to Ask a Question