Operating System - HP-UX
1832585 Members
3207 Online
110043 Solutions
New Discussion

Re: a script run through sam, "custom application"'s "read variable" command makes the variable a double

 
Ben Sachs_1
Advisor

a script run through sam, "custom application"'s "read variable" command makes the variable a double

Hello,

I was having problems with a new script I created, which will be used in the help desk to create an ID. The first thing the script does is ask for the user ID or UID, so I used a "read" command to get the input. I found out that if you enter soemthing like "srs" or "sa" the variable is read as "srssrs" or "sasa" .. ONLY if the script was executed through SAM Custom Application. Longer entries seem to work, its the short ones that have a problem. It didn't happen all of the time, but it happened most of the time. I tried setting the script to use ksh, sh, no difference. From command line it works perfectly every time.

Here is the script I am testing with:
----------------------------
#!/bin/ksh
echo "enter the text"
read something
echo $something
----------------------------
Here is a sample of the output I get in error:

enter the text
sas
sassas

Press to continue sam...

Anyone have any ideas?
-Ben
3 REPLIES 3
Leif Halvarsson_2
Honored Contributor

Re: a script run through sam, "custom application"'s "read variable" command makes the variable a double

Hi
I tested this but I can't reproduce the problem. Is it perhaps something with your terminal emulator. Try to add a line:

echo $something >/tmp/tmpfile

And check what you got in the file.
Ben Sachs_1
Advisor

Re: a script run through sam, "custom application"'s "read variable" command makes the variable a double

Leif,

I tried that.. I also changed the script to a while loop so I could play for a while within that sam session...

#!/bin/ksh

while read -r something
do
echo $something
echo $something >> /tmp/testfile.ben
done

the output is:
srssrs
sassas
srssrs
ben
abc
123
srs
sas

Once I typed in "ben" the problem stopped happening..

Also we are using Reflection/X .. HP-UX is 11.00 and the model is a D370

-Ben
Ben Sachs_1
Advisor

Re: a script run through sam, "custom application"'s "read variable" command makes the variable a double

We also tried using this perl script, and get the same problem:

#!/usr/contrib/bin/perl

$uid = "";
$uid = ;
printf "$uid";

the output is:

srs
srssrs

Press to continue sam...

Hmmm......
-Ben