How to pass variable variable

Dear Unix guru's,

I have a SUSE linux variant with SAP running on it. From SAP it is possible to call UNIX commands, like the shell with parameters.
We have several of these systems, like a development system (DEV), a test system (TST) and a production system (PRD).

I have created a shell-script that works, but it references the machines in a hardcoded way. So my scripts work on PRD but not on DEV. For example, some datafile that I must work with in my script is located in directory:
/interface/PRD/in
Unfortunately it is company policy to have the system name in the directory tree.

One rule of my script (as an example) looks like this:
cp /interface/PRD/in/* /interface/PRD/work

Now I would like to have PRD as a variable so that would become:
cp /interface/$1/in/* /interface/$1/work

In this manner I can copy the scripts from one machine to another and they can still run. However, the parameter $1 for the script should be filled based on the content of a file: sysid.cfg which will contain one line only with the value DEV, TST or PRD. I can generate such a file from my SAP system.

Any suggestions on how I can do this?

(PS: I am not a UNIX guy, so please use plenty of explanation in your answer...:o)

You've sort of answered you question, you substituted $1 which is the first command line argument to executing your script.

i.e.
# ./myscript.sh option1

$1 = option1

To verify you an do something like:

#!/bin/sh
#test_commandline_args.sh

echo $1

Now you should definitely create just 1 script across your 3 different environments, this can be done in many ways, you can query the hostname of the system if it can designate which is PROD/TEST/DEV or you can do what you had mentioned, which was to accept command line arguments. You can also do some checking to verify that its only one of the 3 options and error on any other input.

i.e.

#!/bin/sh
# myscript.sh

if [ $# != 1 ]; then
        echo "Usage: $0 [option]"
        echo "Option: PROD, TEST, DEV"
        echo -e "\ti.e. - $0 PROD\n"
        exit 1
fi

case $1 in
        PROD|prod)
                        ENV="PROD"
                        ;;
        TEST|test)
                        ENV="TEST"
                        ;;
        DEV|dev)
                        ENV="DEV"
                        ;;
                *)
                        echo "Usage: $0 [option]"
                        echo "Option: PROD, TEST, DEV"
                        ;;
esac

## use variable "ENV" to pass into the directory structure ##
echo $ENV

This should help, there's more than one way to do this but here's an option