Output with quotations

I will invoke a shell script.

bash -x ./00_remove_tenants_FR_BE_instanceData.sh CGD2ICON CGDEV2 50005 cgdev2@123

I need a string of

"cgdev2/'cgdev2@123'@localhost:50005/cgd2icon"
parameters ==>              2nd         4th                              3rd          1st

How can I achieve this?

#! /bin/bash

##

##
## Usage: bash ./00_remove_tenants_FR_BE_instanceData.sh <DBNAME> <InstanceUser> <InstancePort> <InstanceUserPWD>
## Example: bash ./00_remove_tenants_FR_BE_instanceData.sh VMPXAT11 vmpxat11 60100 ???PWD???
##

set -e

function usage ()
{
    echo "Usage: `basename $0`  DBNAME  instUser  instPort  instUserPWD  \"tenantIDs\""
    echo "Deletes rows from all database tables in Schema ICON for given list of tenantIDs."
    echo ""
    echo "Required command line parameters:"
    echo "  DBNAME                     Db2 database name"
    echo "  instUser                   Db2 instance user for given database"
    echo "  instPort                   Port number       for given database"
    echo "  instUserPWD                Password          for given instance user"
    echo " \"tenantIDs\"                 Comma separated list of tenantID literals enclosed in single quotes, e. g. '53137FR','51331BE'"
    echo ""
}


## Script Input Parameters
export DBNAME=${1:?"1st parameter 'Database name' is empty!"}
export instUser=${2:?"2nd parameter 'Instance user' is empty!"}
export instPort=${3:?"3rd parameter 'Port number' is empty!"}
export instUserPWD=${4:?"4th parameter 'Password' for instance user is empty!"}

export DB2CODEPAGE=120
echo $str
# it will print "cgdev2/'cgdev2@123'@localhost:50005/cgd2icon"

How to achieve this?

Try:

printf "\"%s/'%s'@localhost:%s/%s\"\n" "$instUser" "$instUserPWD" "$instPort" "$DBNAME"

Hi pranabpal,
The code Scrutinizer has suggested seems to match your description of your problem.

But it doesn't produce the output you say you want with the sample input you provided. Why is it that your sample output converted the upper-case characters in the first two command-line operands to lower-case before printing them when there is no mention of performing any conversions in the description of your problem?

Thanks.