Operating System - HP-UX
1756017 Members
3684 Online
108839 Solutions
New Discussion юеВ

passing variable to connect direct

 
SOLVED
Go to solution
steven Burgess_2
Honored Contributor

passing variable to connect direct

Hi all

I posted this question last night but in the wrong area, so here goes again

I have a whole bunch of files in a directory that I need to submit using connect direct

I have created the following script to do this.

It works if I submit one file manually - However there is more than one file and having to past each file into the submit defeats the object

#!/usr/sbin/sh
cd $XELOGD/connectd
ls xeSnd* > $XELOGD/connectd/cube

CUBES=cube
for file in $(cat $CUBE)
do
export $file
echo 'submit file=/tmp/$file;' | direct | grep process >> /tmp/processid
done

The above bombs out with the message

XSQF009I Return Code: 8 Feedback: 2
:&FILENAME=/tmp/$file:&OSERR=2:

XAPI006I Return Code: 0 Feedback: 0
Specified file could not be opened.


Any help would be greatly appreciated

Thanks in advance

Steve

take your time and think things through
15 REPLIES 15

Re: passing variable to connect direct

aarrghh - the dreaded NDM! You poor soul!

In this case however the error is in your script - replace:

echo 'submit file=/tmp/$file;' | direct | grep process >> /tmp/processid

with:

echo "submit file=/tmp/$file;" | direct | grep process >> /tmp/processid

The single quotes make everything inside them literal (no variable substitution), hence the error message. I seem to remember you should also use the '-x' flag when calling direct from the command line (but I can't remember why!)

echo "submit file=/tmp/$file;" | direct -x | grep process >> /tmp/processid

HTH

Duncan

I am an HPE Employee
Accept or Kudo
steven Burgess_2
Honored Contributor

Re: passing variable to connect direct

Hi duncan

Nope, it doesn't work

$ echo $(cat $file)
xeSndCube_CC_C_.26774

$ echo "submit file=/tmp/$file;" |direct -x
| grep process >> /tmp/process.out

XSQF009I Return Code: 8 Feedback: 2
:&FILENAME=/tmp/file:&OSERR=2:

XAPI006I Return Code: 0 Feedback: 0
Specified file could not be opened.


Regards

Steve
take your time and think things through
Deepak Extross
Honored Contributor

Re: passing variable to connect direct

Steven,
Have you replaced the HostName with or is it literally
xeSndCube_CC_C_.26774 ?

If it is a literal, the shell is going to get confused by the '<', which normally is a redirection operator.

This should work:
xeSndCube_CC_C_\.26774

steven Burgess_2
Honored Contributor

Re: passing variable to connect direct

Deepak

I only used to mask the name of the host from the forum

Regards

Steve
take your time and think things through
steven Burgess_2
Honored Contributor

Re: passing variable to connect direct

Hi

The issue seems to be with the variable $file being passed to the connect direct session

Steve
take your time and think things through
Deepak Extross
Honored Contributor

Re: passing variable to connect direct

OK, heres another thing you can try.

for file in $(cat $CUBE) do echo "submit file=/tmp/$file;"
done >> ./myfile

Check that the contents of myfile are ok, and then run a

for myfile in $(cat ./myfile)
do
echo $myfile | direct | grep process >> /tmp/processid
done

Hope this helps.
steven Burgess_2
Honored Contributor

Re: passing variable to connect direct

Hi Deepak

Thanks for the reply, still getting the errors, a little different this time though

XPAE003I Return Code: 8 Feedback: 0
:&KEYWD=file:

XPAM001I Return Code: 8 Feedback: 0
Errors Parsing

Cheers

Steve
take your time and think things through
Deepak Extross
Honored Contributor

Re: passing variable to connect direct

Did the intermediate file come out ok? What does "cat ./myfile" show?
steven Burgess_2
Honored Contributor

Re: passing variable to connect direct

Hi

myfile is fine

submit file=/tmp/xeSndCube_CC_C_SI***W3.26774;

Steve

take your time and think things through