Computing.Net > Forums > Unix > Unix script using Korn Shell

Unix script using Korn Shell

Reply to Message Icon

Original Message
Name: yy1
Date: May 1, 2006 at 23:31:28 Pacific
Subject: Unix script using Korn Shell
OS: UNIX
CPU/Ram: 4 CPU
Model/Manufacturer: HP-UX
Comment:

Any idea how is the function key F8 being map in unix script using Ksh Shell?

For example: enter key is recognize as ^M, so what is the control key for Tab and F8.

Actually I have an interactive program which prompt user for serveral input and finally user got to press F8 key to execute the process.

The sequence of entry should be:
1. enter date1
2. Press tab key for next date2 entry
3. enter date2
4. press enter key twice to go to next screen
5. press F8 to process all records.

In my scripts, the process need to be triggered automatically by any cron process (without any change to the interactive program). The program will be called by passing the appropriate parameters. My scripts are something like below:

Assuming:
date1 = 31/05/2006
date2 = 1/06/2006
Process path/process = /proj/prog.exe
Enter key below already replaced with ^M

ksh -c "echo 31/05/2006 <Tab_key> 1/06/2006^M^M <F8 ctrl-key> |/proj/prog.exe " << ^M
!


My problem now is:
1. What should be the tab key ?
2. What shoudl be the F8 control key ?

I would be very gratefully if you can assist me on the above issue.


Report Offensive Message For Removal


Response Number 1
Name: lchi2000g
Date: May 2, 2006 at 06:45:23 Pacific
Subject: Unix script using Korn Shell
Reply: (edit)

==> F8

In vi editor, follow the steps below:

1. press i - to go to vi insert mode
2. press Ctr-v - to go to vi special character insert mode
3. press F8 key - to insert the special character F8
4. press Esc key - to go back to command mode
5. done inserting the F8 special character

==> Tab

In vi editor, follow the steps below:

1. press i - to go to vi insert mode
2. press tab key - to insert the tab
3. press Esc key - to go back to command mode
4. done inserting the tab charactor


Luke Chi


Report Offensive Follow Up For Removal

Response Number 2
Name: yy1
Date: May 3, 2006 at 00:52:29 Pacific
Subject: Unix script using Korn Shell
Reply: (edit)

Hi Luke Chi,

Thank you for your reply.

I managed to get the control character for F8 which is ^AG, but then for tab key, it did not show any control character mapping?
Were there be any control character mapping for tab key ?


Report Offensive Follow Up For Removal

Response Number 3
Name: lchi2000g
Date: May 3, 2006 at 06:08:50 Pacific
Subject: Unix script using Korn Shell
Reply: (edit)

vi "shows" the blanks of the tab on the screen to you. Actually when the file with the tab char is saved, the special char of tab is saved - not the blanks.

To see the tab special char in vi:

1. press Esc - to go to vi command mode
2. type :set list and press Enter
3. Then, you could see ^I, which is the tab special char. (The $ is the End of Line)


Luke Chi


Report Offensive Follow Up For Removal

Response Number 4
Name: yy1
Date: May 3, 2006 at 19:28:04 Pacific
Subject: Unix script using Korn Shell
Reply: (edit)

Luke Chi,

Thanks again for your help.

However, it seem like my program can't recognize the control character for the F8 key ^AG.

For your information, my program (prog.exe as given in the above example) is written in informix-4GL. Database is also informix.

However, the arguments that pass in from the unix script to the informix-4GL program can't recognize the ^AG (as F8 key).

Do you have any clue on this?

Not too sure if you are familar with INFORMIX stuff, but I just doubt if the F8 key related has something to do with the the TERMCAP/TERMINFO setting?


Report Offensive Follow Up For Removal

Response Number 5
Name: lchi2000g
Date: May 4, 2006 at 10:36:11 Pacific
Subject: Unix script using Korn Shell
Reply: (edit)

Replace:

ksh -c "echo 31/05/2006 <Tab_key> 1/06/2006^M^M <F8 ctrl-key> |/proj/prog.exe " << ^M
!

with:
ksh -c "script.sh"

script.sh:

#!/bin/ksh
/proj/prog.exe <<EOF
31/05/2006<Tab>1/06/2006

<F8>
EOF

Luke Chi


Report Offensive Follow Up For Removal


Response Number 6
Name: yy1
Date: May 9, 2006 at 19:54:23 Pacific
Subject: Unix script using Korn Shell
Reply: (edit)

Hi Luke Chi,

Thanks for you valuable advise and help given so far.

Anywhere I found a solution:

ksh -c "echo 31/05/2006^I1/06/2006^M^M $(tput kf8)|/proj/prog.exe " << ^M
!

For your information, the function key F8 can be represented as $(tput kf8).


Report Offensive Follow Up For Removal






Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Unix script using Korn Shell

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 3 Days.
Discuss in The Lounge