1748201 Members
2927 Online
108759 Solutions
New Discussion юеВ

Script ISSUE

 
SOLVED
Go to solution
Karthick K S
Frequent Advisor

Script ISSUE

Hi,

I am facing some problem on script,
i want to assign output(i.e some file) to some variable its given below, after that i want rename this filename.

gmfile=$(/opt/mqm/scripts/mqigetfn CREATE ${DIRECTORY}/ ${QNAME} ${QMANAGER})

mv gmfile xxtest.txt

but its not working pls help me on this

21 REPLIES 21
RAC_1
Honored Contributor

Re: Script ISSUE

Can you run the command manually??

Have you set all required variables??

set -vx, now do gmfile=$(/opt/mqm/scripts/mqigetfn CREATE ${DIRECTORY}/ ${QNAME} ${QMANAGER})

Does complain about anything??
There is no substitute to HARDWORK
Karthick K S
Frequent Advisor

Re: Script ISSUE

Hi RAC,

I set all varibales

i runned the same but its same problem file received on filesystem but not assign to variable

Muthukumar_5
Honored Contributor

Re: Script ISSUE

Can you post what you are getting for?

/opt/mqm/scripts/mqigetfn CREATE ${DIRECTORY}/ ${QNAME} ${QMANAGER}

gmfile="$(/opt/mqm/scripts/mqigetfn CREATE ${DIRECTORY}/ ${QNAME} ${QMANAGER})"
echo ${gmfile}

post this information.!

hth.
Easy to suggest when don't know about the problem!
Karthick K S
Frequent Advisor

Re: Script ISSUE


/opt/mqm/scripts/mqigetfn CREATE /usr/ ${QNAME} ${QMANAGER}
For this output is,
file will copied on filesystem /usr/

gmfile="$(/opt/mqm/scripts/mqigetfn CREATE ${DIRECTORY}/ ${QNAME} ${QMANAGER})"
echo ${gmfile}

for this output is,
null there is no output but file copied to filesystem

Actually what my problem i receive file containing ^M containing i want to remove ^M character then copied to that samefilename
Muthukumar_5
Honored Contributor

Re: Script ISSUE

^M characters will be added when you transfer a file from dos.

Change it as,

dos2ux filename > newfile

strings filename > newfile

It will be changed.

hth.
Easy to suggest when don't know about the problem!
Muthukumar_5
Honored Contributor

Re: Script ISSUE

Refer this to remove ^M characters more,

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=972302

If you want to change into the same file then,

perl -pi -e 's/\^M//g' filename

hth.
Easy to suggest when don't know about the problem!
Karthick K S
Frequent Advisor

Re: Script ISSUE

I know that dos2ux but for eg.

my file name is hptest.txt

opt/mqm/scripts/mqigetfn CREATE /usr/ ${QNAME} ${QMANAGER

after i runned this one

/usr/hptest.txt but containing ^M character

i want to remove ^M character then filename should be /usr/hptest.txt


RAC_1
Honored Contributor

Re: Script ISSUE

does following work??

gmfile=$(/opt/mqm/scripts/mqigetfn CREATE "${DIRECTORY}/ ${QNAME} ${QMANAGER}")

echo ${gmfile}
There is no substitute to HARDWORK
Muthukumar_5
Honored Contributor

Re: Script ISSUE

Do like,

/opt/mqm/scripts/mqigetfn CREATE /usr/ ${QNAME} ${QMANAGER}
perl -pi -e 's/\^M//g' /usr/hptest.txt

It will do it.

hth.

Easy to suggest when don't know about the problem!