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!

Hi.

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

> 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.

#!/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/comp.unix.shell/2004-05/0052.html

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.

------------------------------------------------------------------------------------

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.