Sponsored Content
Full Discussion: Bash INKEY$ function...
Top Forums UNIX for Dummies Questions & Answers Bash INKEY$ function... Post 302785801 by Corona688 on Tuesday 26th of March 2013 11:44:46 AM
Old 03-26-2013
For one thing, it assumes that a keystroke is one character(frequently untrue).

For another, it runs stty twice per keystroke... I'd be tempted to leave the terminal as is instead of changing it that often, save you a lot of CPU time.

This should work work:

Code:
stty -icanon min 0 time 1

key=`dd count=1 2>/dev/null`

...

It should be able to read entire keystrokes at once.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need assistance with bash function

Hi all! I need a little help with an imbedded fuction I am trying to write. What I am trying to do is go to a series of hosts and get the contents of an XML file, storing some of the data, along with the name of the host it was gathered from. My intent is to store this in an array for later... (1 Reply)
Discussion started by: _jade_
1 Replies

2. Shell Programming and Scripting

Need help in using power function in Bash

Hi, I would like to use a power function in Bash in an awk '{ } . e.g pow(2,3)=8 Any suggestion? I try to find online resources but most of them stated by using BC. Please advise. Thanks. (3 Replies)
Discussion started by: ahjiefreak
3 Replies

3. Shell Programming and Scripting

bash search function

I want to have a function with a similar interface: search *.cpp asdf that will search recursively all directories for *.cpp file, containing line 'asdf' inside. I tried this: function search { find . -name "$1" | xargs grep -li $2; } But it doesn't work all the time. For example, if i run it... (3 Replies)
Discussion started by: doze
3 Replies

4. Shell Programming and Scripting

[Bash]Function returning a boolean

Hello all, I would like to know if it is possible to return a the result of a boolean expression from a function like this function() { # some code return || } and what will be the return value ? Thank you for help. (6 Replies)
Discussion started by: dolphin06
6 Replies

5. Shell Programming and Scripting

In bash getting weird output from function ?

My script- result="" times() { echo "inside the times function" result=8 echo "Inside function $result" return $result } result=$(times) echo "the value is "$? echo "the value of result $result" when I run I get this, why the value still remain 0. $ ./func the value is 0 the value... (5 Replies)
Discussion started by: boy18nj
5 Replies

6. Shell Programming and Scripting

BASH function error

Hey everyone. I am currently testing my first function based BASH script. The ultimate goal is going to be moving logs from point A to point B (or if B is down, to point C). Part of this involves the following function: function testAlive{ ping -c 1 -q $1 } Now when I run ping -c... (1 Reply)
Discussion started by: msarro
1 Replies

7. Shell Programming and Scripting

Bash function

startvm() { startguest } Is there a way use one line to get this ? actually I want startvm=startguest (5 Replies)
Discussion started by: yanglei_fage
5 Replies

8. Shell Programming and Scripting

Yes or No selection within bash function

I need to add a selection within the bash function below and am having some trouble doing so. phox2b() { printf "\n\n" printf "What is the id of the patient getting Phox2B analysis : "; read id printf "Is this an intronic variant? Y/N "; read match_choice case... (5 Replies)
Discussion started by: cmccabe
5 Replies

9. Shell Programming and Scripting

Bash function, for BSD

I am putting this thread to shell-threads, because it is about how to make a function work properly. I need a hint for declaring a function right, it has been more than a year I did not work that straight with bash. So my aim is to turn off the eth0 (as it would be in linux, and bge0 in bsd ),... (2 Replies)
Discussion started by: 1in10
2 Replies

10. Shell Programming and Scripting

Bash function problem

I am trying to figure out why I am having a "problem" with some functions in a bash script I am running. The reason for air quoting is that the functions are working, they are just not displaying anything to screen when called from another function. Here's an example: function Create_Input {... (6 Replies)
Discussion started by: dagamier
6 Replies
getprocxsec(1M) 														   getprocxsec(1M)

NAME
getprocxsec - display security attributes of a process SYNOPSIS
DESCRIPTION
The command displays security attributes associated with a running process. These attributes include the permitted privilege set, effec- tive privilege set, retained privilege set, euid, and the compartment name. See privileges(5) and compartments(5). Each process has a permitted privilege set, effective privilege set, and retained privilege set. If the compartmentalization feature is enabled, it also has a compartment. When a process is created, the child process inherits these attributes from the parent. When a process executes a binary, these attributes can be changed. See setfilexsec(1M) and getfilexsec(1M) for information on how these extended attributes can be manipulated at execution time. For compatibility, the kernel handles processes with effective uid of zero in special ways. If the compartmentalization feature is dis- abled, these processes are treated as though they have all root replacement privileges. If, on the other hand, the compartmentalization feature is enabled, these processes are treated as though they have all the root replacement privileges except those configured as disal- lowed privileges for the compartment. Options recognizes the following options: Displays the compartment name of the process. If compartments are not enabled, nothing is reported for this option. If compartments are enabled, all the kernel processes would be reported as running in "RESERVED CMPT" . Displays the implementation effective privilege set. Displays the full form of the lists. Displays the implementation permitted privilege set. Display the implementation retained privilege set. If none of the above options are specified, the default is Operands recognizes the following operand: pid The process ID of the process whose attributes are being displayed. If pid is displays attributes of this process. If pid is it displays attributes of the process' parent. If pid is not specified, it defaults to this process (equivalent to Security Restrictions The specified process must be visible to the user invoking this command or the user must have the privilege. RETURN VALUE
returns the following values: Successful completion. The attributes are displayed. An error occurred. An error can be caused by an invalid option or because the specified process is not visible to the user. EXAMPLES
Example 1: Display the privilege sets and compartment of the current process: Sample output: effective= BASIC permitted= BASIC retained= BASIC cmpt= init euid= zero Example 2: Display the privilege sets and compartment of the parent process: Sample output: effective= BASIC permitted= BASIC retained= BASIC cmpt= init euid= zero Example 3: Display the full privilege sets and compartment of an arbitrary process: Sample output: effective= FORK EXEC SESSION LINKANY permitted= FORK EXEC SESSION LINKANY retained= FORK EXEC SESSION LINKANY cmpt= web euid= non-zero SEE ALSO
getfilexsec(1M), setfilexsec(1M), compartments(5), privileges(5). getprocxsec(1M)
All times are GMT -4. The time now is 01:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy