Sponsored Content
Top Forums Shell Programming and Scripting How to emulate ^S/^Q from a script Post 302393968 by AliceD on Wednesday 10th of February 2010 05:53:58 AM
Old 02-10-2010
Some more info

I guess what I want is to create some sort of screen buffer. Not sure if it can be achieved with flow control. I want to stop sending chars to the screen, draw the screen, then send all of the chars at once, instead of one line at a time.

Anyway here is a "Screenshot" of the script running
Code:
Doing p1lld5p1.ksh creating p1lld5p1.ksh.LV21057
Step Selected   Step Text
S0020=A [ ] [ ] S0070=A
S0030=A [ ] [ ] JSTEP=S0070; ((XSTEP+=1)); SCC=0; LCC=0; alias goto="";
S0040=A [ ] [ ] stepctl51
S0050=A [ ] [ ] exportfile IN01 pisop/sysin/p1llbtch
S0060=A [ ] [ ] exportfile IN02 pisop/sysin/p1ld5p1a
S0070=A [X] [ ] cat $IN01 > $SYOT/${JSTEP}_p1ld5p1a
S0080=A [ ] [ ] awk 'print $0"' $IN02 >> $SYOT/${JSTEP}_p1ld5p1a
S0090=A [ ] [ ] awk '2"' $IN02 >> $SYOT/${JSTEP}_p1ld5p1a
S0100=A [ ] [ ] exportfile IN $SYOT/${JSTEP}_p1ld5p1a
S9000=A [ ] [ ] exportfile OUT $SYOT/${JSTEP}_Q3086_MOR_out
S9900=A [ ] [ ] exportfile TRAN psall/p1.xl.periodiccharges2.t3097out
               ### **** comment ***
               exportfile SYSOUT $SYOT/${JSTEP}_SYSOUT
               dbblp -u DFE -d $SAPDBID -BT -i $IN -o $OUT -dt $INPUTDATE -tr $TRAN,a
               #4----------------------------------------------------------------------
               LCC=$?; S0070C=$LCC; ((SCC+=LCC)); ((JCC+=LCC)); S0070R=1; alias goto="";
               if ((S0070C > 8))
               then logmsg1 "step#$JSTEP abterm $SCC"
               alias goto="<<S9900=A"; fi
               goto

And here is the function that displays the step text.
Code:
function DisplayStep
{
stty -echo -raw                                       # Stop keyboard input
##Clear the previous one first
DISPLINE=2                                            # Init var, want to start on line 2
while [ DISPLINE -lt $SCREENLINES ]                   # Clear out the currently displayed text
do
tput cup $DISPLINE 30                               # Position the cursor
## The echo of all the spaces seem to be a lot faster than the tput el to erase a line
##  tput el
echo '                                                                                                                               '
(( DISPLINE++ ))                                    # Add one to var
done
SCREENLINES=2                                         # Init var, want to start on line 2
DISPLINE=2                                            # Init var, want to start on line 2
## Set the field seperator to enter
IFS='
'
for ONELINE in `echo "${STEPDETAIL[$ELEMENT]}"`       # Loop through the text delimited by enter.
do
tput cup $DISPLINE 30                              # Position the cursor
echo "${ONELINE}"                                  # Display the text
(( DISPLINE++ ))                                   # Increase the row to display the next line on
(( SCREENLINES++ ))                                # Count of lines to clear next time the function is called
if [ $DISPLINE == $MAXLINES ]                      # Stop the script from scrolling off the bottom of the screen. Just display as much as it can.
then
   break
fi
done
unset IFS                                             # Reset the IFS
stty -echo raw                                        # Accept keyboard input again
tput cup $CPOSY $CPOSX                                # Put the cursor where it was
}

At the top of the function I would like to stop display to the screen and then at the end enable it again and send all the echoe's at once.

It is probably not possible in a script. This is a Korn shell script.

STTY and Linux info
Code:
speed 38400 baud; rows 62; columns 157; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;
flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke
 
Linux 2.6.9-89.0.16.ELsmp
i386

Any help with getting the display faster would be appreciated.

It is workable at the moment, but it bugs me. I know using emacs and some sort of C program would be the best, but we don't have C at our site.

Thanks!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

tool to emulate keystrokes out to a ps/2 device?

hey all, i am trying to connect my mac to my sony DVD changer so that i can control one aspect of it with any kind of shell script or program. the DVD player allows you to plug in a PS/2 keyboard to navigate it's on screen menu. what i want to do is use my mac to navigate my own menus, then... (0 Replies)
Discussion started by: drzoomn
0 Replies

2. UNIX for Dummies Questions & Answers

How can emulate unix on my PocketPC?

I just want to learn more not just reading but also practicing at the same time :) (0 Replies)
Discussion started by: MFT39
0 Replies

3. Shell Programming and Scripting

Script to emulate ls -lh?

Does anyone have a script they would like to share that emulates "ls -lh" in ksh on Solaris 8? Yeah, I know. Real men don't need that wimpy "h." Well, I'm a wimp. ;) (0 Replies)
Discussion started by: shew01
0 Replies

4. Shell Programming and Scripting

Shell quiz: emulate an associative array

Most shells flavors do not have associative arrays a.k.a. maps. How would you emulate an associative array? I had this problem once and found a working solution, but I don't want to spoil the game hence I wont tell it. Wonder if anyone comes up with something better. (5 Replies)
Discussion started by: colemar
5 Replies

5. Shell Programming and Scripting

Emulate ksh's FPATH variable in bash

Over time i have developed a library of useful (ksh) functions which i use in most of my scripts. I use the ksh's FPATH variable to locate all these functions and use a standard environment-setting-function to always have the same environment in all my scripts. Here is how i begin scripts: ... (3 Replies)
Discussion started by: bakunin
3 Replies

6. UNIX for Dummies Questions & Answers

can I emulate solaris/sparc on virtualbox? Or other emulator to run solaris for sparc in my win7 PC?

Hi Gurus can I emulate solaris/sparc on virtualbox? Or other emulator to run solaris for sparc in my win7 PC? regards, Israel. (9 Replies)
Discussion started by: iga3725
9 Replies

7. UNIX for Dummies Questions & Answers

emulate aix 5.3 , how ....? pearpc didn't work

how to emulate aix 5.3 i had try pearpc , but it didn't work ... someone have some solution? thanks (1 Reply)
Discussion started by: prpkrk
1 Replies

8. Shell Programming and Scripting

Emulate fgrep -f in perl

Is there any equivalent of the below requirement in perl fgrep -f file1 file2 > file3 (2 Replies)
Discussion started by: aravindj80
2 Replies

9. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

10. Shell Programming and Scripting

Emulate group-by in shell script

Hello All, I saw this problem on one of the forum and solved it using group-by in oracle sql, though I am a bit curious to implement it using shell script : There is a file having number of operations : Opeation,Time-Taken operation1,83621 operation2,72321 operation3,13288... (11 Replies)
Discussion started by: mukulverma2408
11 Replies
All times are GMT -4. The time now is 02:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy