04-29-2011
KSH command completions.
I want to do the Auto command completion in ksh for my product's CLI. For that I am using the key binding mechanism. But am stuck at following points.
1. I am not able to use .sh.edtext variable while KEYBD trap. As I know this variable contains Characters in the input buffer during a KEYBD trap. But in my script, this variable is always NULL. Can you please tell me How can I get the content of input buffer in my script.
2. If somehow I get the input buffer in my script then I have to compute the next possible completions based on the input buffer. Now:
A. If there is only completion.
In this case I have to append this to input buffer and put this new string on command prompt. How can I replace the content of command prompt with new string?
B. If there are more than 1 possible completion:-
I have to show all completions below the command prompt. This I can do with print command. Is there any other ways to do this.
I am using the following script for key bind:-
-------------------------------
typeset -A Keytable
trap 'eval "${Keytable[${.sh.edchar}]}" && VX_COMMAND=${.sh.edtext}' KEYBD
function keybind # key [action]
{
typeset key=$(print -f "%q" "$2")
case $# in
2) Keytable[$1]="$key"
;;
1) unset Keytable[$1]
;;
*) print -u2 "Usage: $0 key [action]"
return 2 # usage errors return 2 by default
;;
esac
}
export VX_COMMAND
keybind $'\Ew' function.sh #I want to bind Alt+w with function.sh and want to use input buffer in function.sh.
---------------------------------------
I didn't found these answers with GOOGLE.
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I am very confused with my printf command.
Somehow one variable can't line up with others...
newstart2 ="Mon Nov 11 01 00:00:00 2002"
printf "%-20s" $newstart2
Here is the output:
Mon Nov 11
01 00:00:00 2002
It spread out to two lines..
Why? (1 Reply)
Discussion started by: cin2000
1 Replies
2. Shell Programming and Scripting
Hi,
Any help or suggestions would be most appreciated. I am having problems in the latter end of this ksh script where I will be checking two files. If they exist do nothing otherwise I need to reinitialize the database which resides on o/s Aix 5.3. The problem I am facing is when the reinit... (2 Replies)
Discussion started by: hgjdv
2 Replies
3. Shell Programming and Scripting
Hi,
i am facing an error in the korn shell by executing the following script, can anyone help me out in solving the error..
Note: /root/kamal is a directory
size_dir=$(du -s /root/kamal | cut -f1)
echo $size_dir
error: invalid $ at ( in size_dir
Thanks &... (2 Replies)
Discussion started by: G.K.K
2 Replies
4. Shell Programming and Scripting
Sorry for the duplicate thread this one is similar to the one in
https://www.unix.com/shell-programming-scripting/88132-awk-sed-script-read-values-parameter-files.html#post302255121
Since there were no responses on the parent thread since it got resolved partially i thought to open the new... (4 Replies)
Discussion started by: rajan_san
4 Replies
5. Shell Programming and Scripting
$var=`command <arg> <arg>`
I thought there was another method
$var=$(command <arg> <arg>)
I thought I read saw the second example. It doesnt work (2 Replies)
Discussion started by: popeye
2 Replies
6. Shell Programming and Scripting
Hello,
I am trying to run a remote file (y.ksh) using rsh.
In this action i want to use an environment variable TOOL=/home/macc1
i am running the rsh from profile macc on server1.
rsh server2 -l macc1 "$TOOL/y.ksh"
but i can see that the executable command = /home/macc/y.ksh and not... (1 Reply)
Discussion started by: LiorAmitai
1 Replies
7. Shell Programming and Scripting
I want to do the Auto command completion in ksh for my product's CLI. For that I am using the key binding mechanism. But am stuck at following points.
1. I am not able to use .sh.edtext variable while KEYBD trap. As I know this variable contains Characters in the input buffer during... (1 Reply)
Discussion started by: Surendra_Singh
1 Replies
8. Shell Programming and Scripting
I probably read all the threads in almost all the forums for a solution to my need. I am a beginner in shell scripting and I dont have a perfect solution yet. Below is my code snippet.
idql -n $REPOSITORY_NAME.$cs -Udmadmin -P"" -R$DM_SCRIPTS/test.api > /dev/null 2>&1
if ; then
echo... (7 Replies)
Discussion started by: vishnudev1
7 Replies
9. Shell Programming and Scripting
I am trying to use awk command withing ksh.
ksh "echo \"my name\" | awk '{print $2}'"
I am getting out as :
my name
Expected output:
name
When I use
echo "my name" | awk '{print $2}'
I am getting the correct output:
name
I am not sure what mistake I am doing when using awk... (1 Reply)
Discussion started by: Bala_db2
1 Replies
LEARN ABOUT OPENSOLARIS
vconsole.conf
VCONSOLE.CONF(5) vconsole.conf VCONSOLE.CONF(5)
NAME
vconsole.conf - configuration file for the virtual console
SYNOPSIS
/etc/vconsole.conf
DESCRIPTION
The /etc/vconsole.conf file configures the virtual console, i.e. keyboard mapping and console font.
The basic file format of the vconsole.conf is a newline-separated list environment-like shell-compatible variable assignments. It is
possible to source the configuration from shell scripts, however, beyond mere variable assignments no shell features are supported,
allowing applications to read the file without implementing a shell compatible execution engine.
Note that the kernel command line options vconsole.keymap=, vconsole.keymap.toggle=, vconsole.font=, vconsole.font.map=,
vconsole.font.unimap= may be used to override the console settings at boot.
Depending on the operating system other configuration files might be checked for configuration of the virtual console as well, however only
as fallback.
OPTIONS
The following options are understood:
KEYMAP=, KEYMAP_TOGGLE=
Configures the key mapping table of for they keyboard. KEYMAP= defaults to us if not set. The KEYMAP_TOGGLE= can be used to configured
a second toggle keymap and is by default unset.
FONT=, FONT_MAP=, FONT_UNIMAP=
Configures the console font, the console map and the unicode font map. FONT= defaults to latarcyrheb-sun16.
EXAMPLE
Example 1. German keyboard and console
/etc/vconsole.conf:
KEYMAP=de-latin1
FONT=latarcyrheb-sun16
SEE ALSO
systemd(1), loadkeys(1), setfont(8), locale.conf(5)
AUTHOR
Lennart Poettering <lennart@poettering.net>
Developer
systemd 10/07/2013 VCONSOLE.CONF(5)