I'm a Unix newbie.
In a shell-script, is there any way to accept keyboard input (via STDIN) without having it display on the screen? I know keying in a login password sort of does this by replacing what you key with astericks (*) but I believe that's a "C" routine. I'd like to be able to... (2 Replies)
How can I write to another user's pseudo tty, but not to its current prompt position (as in open("/dev/pts007", ...) followed by write() ). Instead I would like to write to the top center of the screen using color red, for example. Like curses, but from another console. (6 Replies)
I am developing a script that will run with '/bin/ksh' shell.
The script is intended to receive a password by keyboard input, but for security reasons I would like to hide what the user is typing.
The keyboard input is being caught by 'read' command.
exmaple :
echo "Please type your new... (1 Reply)
Hi all,
i type a command along with dtterm what i would like to have is that the output of the command to be shown in the new terminal .
Any Idea on how to acheive this? (0 Replies)
Hey,
How can I transfer the terminal output to a file ?
For example :
command "fuser" returns the "process-id" and prints the output on the terminal, but I want that output to a file as well. How can I do that ?
/clocal/mqbrkrs/user/mqsiadm/sanjay/AccessMonitor $ fuser -uf... (2 Replies)
My knowledge of Unix input/output/devices is very hazy so could someone please tell me if the following is secure?
I log on to an account on a shared Unix server (Linux 2.6.18-6-686) using ssh (PuTTY). I start a python program and then type into it (python raw_input command) the... (2 Replies)
Hello everybody!!!
I am writing my own rm command in unix.
I prompt the user to type if he wants to delete a file and then read what he typed.
But how do i check what he typed?
This is my program so far:
echo 'Delete prog1.c (y/n)?'
read yesOrNo
if yesOrNo == 'y'
then
rm prog1.c... (6 Replies)
Hello, everyone.
Could someone, please, tell me how to get the number of bytes in the terminal input queue without blocking and without consuming these bytes? I guess it could be called the peek functionality.
I've looked at termio tcgetattr() and tcsetattr() functions but could not find... (4 Replies)
This is my input file like this
03,105581,,015,+00000416418,,,901,+00000000148,,,922,+00000000354,,/
49,+00000000000416920,00002/
03,5313236,,015,+00231036992,,,045,+00231036992,,,901,+00000048428,,/
88,100,+0000000000000,0000000,,400,+0000000000000,0000000,/
88,902,+0000000079077,,/... (0 Replies)
Hello All,
I have a text file containing output from a command that contains lots of escape/control characters that when viewed using vi or view, looks like jibberish. But when viewed using the cat command the output is formatted properly.
Is there any way to take the output from the cat... (7 Replies)
Discussion started by: mrm5102
7 Replies
LEARN ABOUT DEBIAN
text::findindent
Text::FindIndent(3pm) User Contributed Perl Documentation Text::FindIndent(3pm)NAME
Text::FindIndent - Heuristically determine the indent style
SYNOPSIS
use Text::FindIndent;
my $indentation_type = Text::FindIndent->parse($text, skip_pod => 1);
if ($indentation_type =~ /^s(d+)/) {
print "Indentation with $1 spaces
";
}
elsif ($indentation_type =~ /^t(d+)/) {
print "Indentation with tabs, a tab should indent by $1 characters
";
}
elsif ($indentation_type =~ /^m(d+)/) {
print "Indentation with $1 characters in tab/space mixed mode
";
}
else {
print "Indentation style unknown
";
}
DESCRIPTION
This is a module that attempts to intuit the underlying indent "policy" for a text file (most likely a source code file).
METHODS
parse
The class method "parse" tries to determine the indentation style of the given piece of text (which must start at a new line and can be
passed in either as a string or as a reference to a scalar containing the string).
Returns a letter followed by a number. If the letter is "s", then the text is most likely indented with spaces. The number indicates the
number of spaces used for indentation. A "t" indicates tabs. The number after the "t" indicates the number characters each level of
indentation corresponds to. A "u" indicates that the indenation style could not be determined. Finally, an "m" followed by a number means
that this many characters are used for each indentation level, but the indentation is an arbitrary number of tabs followed by 0-7 spaces.
This can happen if your editor is stupid enough to do smart indentation/whitespace compression. (I.e. replaces all indentations many tabs
as possible but leaves the rest as spaces.)
The function supports parsing of "vim" modelines. Those settings override the heuristics. The modeline's options that are recognized are
"sts"/"softtabstob", "et"/"noet"/"expandtabs"/"noexpandtabs", and "ts"/"tabstop".
Similarly, parsing of "emacs" Local Variables is somewhat supported. "parse" use explicit settings to override the heuristics but uses
style settings only as a fallback. The following options are recognized: "tab-width", "indent-tabs-mode", "c-basic-offset", and "style".
There is one named option that you can pass to "parse()": "skip_pod". When set to true, any section of POD (see perlpod) will be ignored
for indentation finding. This is because verbatim paragraphs and examples embedded in POD or quite often indented differently from normal
Perl code around the POD section. Defaults to false. Example:
my $mode = Text::FindIndent->parse($text, skip_pod => 1);
to_vim_commands
A class method that converts the output of "parse($text)" into a series of vi(m) commands that will configure vim to use the detected
indentation setting. Returns zero (failure) or more lines of text that are suitable for passing to "VIM::DoCommand()" one by one.
As a convenience, if the argument to "to_vim_commands" doesn't look like the output of "parse", it is redirected to "parse" first.
To use this, you can put the following line in your .vimrc if your vim has Perl support. Suggestions on how to do this in a more elegant
way are welcome. The code should be on one line but is broken up for displaying:
map <F5> <Esc> :perl use Text::FindIndent;VIM::DoCommand($_) for
Text::FindIndent->to_vim_commands(join "
", $curbuf->Get(1..$curbuf->Count()));<CR>
(Patches to implement the equivalent for emacs would be welcome as well.)
SUPPORT
Bugs should be reported via the CPAN bug tracker at
<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Text-FindIndent>
For other issues, contact the author.
AUTHOR
Steffen Mueller <smueller@cpan.org>
Adam Kennedy <adamk@cpan.org>
COPYRIGHT
Copyright 2008 - 2010 Steffen Mueller.
Copyright 2008 - 2010 Adam Kennedy,
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
perl v5.10.1 2011-01-04 Text::FindIndent(3pm)