03-25-2013
What read -n 1 is doing here is probably something like stty -icanon min 1 ; get_character ; reset
...since it's not BASH that's preventing you from reading one at a time, but the terminal itself. Usually it's in "canon" mode, or line-by-line.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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
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
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
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
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
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
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
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
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
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
LEARN ABOUT DEBIAN
text::context
Text::Context(3pm) User Contributed Perl Documentation Text::Context(3pm)
NAME
Text::Context - Handle highlighting search result context snippets
SYNOPSIS
use Text::Context;
my $snippet = Text::Context->new($text, @keywords);
$snippet->keywords("foo", "bar"); # In case you change your mind
print $snippet->as_html;
print $snippet->as_text;
DESCRIPTION
Given a piece of text and some search terms, produces an object which locates the search terms in the message, extracts a reasonable-length
string containing all the search terms, and optionally dumps the string out as HTML text with the search terms highlighted in bold.
new
Creates a new snippet object for holding and formatting context for search terms.
keywords
Accessor method to get/set keywords. As the context search is done case-insensitively, the keywords will be lower-cased.
paras
@paras = $self->paras($maxlen)
Return shortened paragraphs to fit together into a snippet of at most $maxlen characters.
as_text
Calculates a "representative" string which contains the given search terms. If there's lots and lots of context between the terms, it's
replaced with an ellipsis.
as_html([ start => "<some tag>", end => "<some end tag>" ])
Markup the snippet as a HTML string using the specified delimiters or with a default set of delimiters ("<span class="quoted">").
AUTHOR
Original author: Simon Cozens
Current maintainer: Tony Bowden
BUGS and QUERIES
Please direct all correspondence regarding this module to:
bug-Text-Context@rt.cpan.org
COPYRIGHT AND LICENSE
Copyright (C) 2002-2005 Kasei
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License; either version
2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
perl v5.10.1 2009-07-23 Text::Context(3pm)