Sponsored Content
Top Forums Shell Programming and Scripting Repeat last entered command ? Post 302134614 by jim mcnamara on Saturday 1st of September 2007 10:43:55 AM
Old 09-01-2007
hold esc then press k
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

getting rid of $ when entered at the command line

Hi everyone, Can someone possibly help me with this problem I am having please. I wrote a Korn shell script to manipulate currency amounts in a way that a person could use this script to determine the minimum number of coins required to make a certain amount. for example when entered on the... (2 Replies)
Discussion started by: bashirpopal
2 Replies

2. UNIX for Dummies Questions & Answers

Append 0 for single digit entered from command line

I have a script like this-- #!/bin/ksh echo "To pad a 0 before digits from 1-9" for i in $* do echo $i | sed 's//'0'/g' done I run this script as ksh name 1 2 23 34 The output should be 01 02 23 34 Help me in modifying this script. Thanks Namish (2 Replies)
Discussion started by: namishtiwari
2 Replies

3. UNIX for Advanced & Expert Users

Repeat output of last command w/o repeating last command

Is there a way to repeat the output of the last command for filtering without running the command again? All I could think of was to copy all the data to a text file and process it that way, is there another way? Like say I want to grep server.server.lan from a dtrace that was pages long after I... (5 Replies)
Discussion started by: glev2005
5 Replies

4. Shell Programming and Scripting

Delete empty files from a directory entered in command prompt

My code to "Delete empty files from a directory entered in command promt" #/bin/sh echo "Enter directory" read gh for file in `ls $gh` do # to get the size of file a=$( ls -l file | awk ' {print $7} '); echo $a if then echo "removing file " rm file fi done (6 Replies)
Discussion started by: adirajup
6 Replies

5. Shell Programming and Scripting

How to loop through array who's name is entered in command line?

Say I have a ksh program called test.ksh which has several defined arrays inside it such as array1,array2,array3...These arrays contain strings. I also have a method in the program: for x in $1 do ....(#do something) done So, when the user enteres: ./test.ksh array1, I want to... (3 Replies)
Discussion started by: mrskittles99
3 Replies

6. Shell Programming and Scripting

Repeat a command for one sec

How to repeat the execution of a simple command like the following for 1 sec ? echo Hi The completion time for the command is not known, but we need to calculate the number of times this commans executes successfully within 1 sec. Thanks Kumarjit (5 Replies)
Discussion started by: kumarjt
5 Replies

7. Shell Programming and Scripting

Perl : accept multiple user entered command line arguemnts

I am trying to create a script that will accept multi input from the user (really just me), then execute those command on a remote device. My question is if the I enter "No" at the confirmation point "Are these statements correct y or n ?", what is the best way to go back and start over ? I... (3 Replies)
Discussion started by: popeye
3 Replies

8. Shell Programming and Scripting

How to accept command line argument as character or text if number is entered?

Hello Does the unix korn shell provide a function to convert number entered in command line argument to text or Character so that in next step i will convert Chr to Hex (6 Replies)
Discussion started by: aadityapatel198
6 Replies

9. Programming

Java: Repeat a command

I came across a site to learn java and they give you practice problems to do. I was wondering if anyone can help me with this since I am totally new to Java. Here is the first problem: Write a program that will read in a name from the command line and write it out 100 times. Thank you for any... (10 Replies)
Discussion started by: totoro125
10 Replies

10. UNIX for Dummies Questions & Answers

How to Repeat history command?

Assume i have typed 4 commands in the past like vi `ls -t |head -n 1` tail -2 test.txt ls -lrt | grep "/etc/profile.d" pwd Now if i type r p it should execute the command "pwd" likewise r t should execute tail -2 test.txt. Note: esc k and using up arrow and down arrow will get this work... (3 Replies)
Discussion started by: Ramanareddygv
3 Replies
Perl::Critic::Policy::RegularExpressions::ProhibitCompleUsereContributed PerlPerl::Critic::Policy::RegularExpressions::ProhibitComplexRegexes(3pm)

NAME
Perl::Critic::Policy::RegularExpressions::ProhibitComplexRegexes - Split long regexps into smaller "qr//" chunks. AFFILIATION
This Policy is part of the core Perl::Critic distribution. DESCRIPTION
Big regexps are hard to read, perhaps even the hardest part of Perl. A good practice to write digestible chunks of regexp and put them together. This policy flags any regexp that is longer than "N" characters, where "N" is a configurable value that defaults to 60. If the regexp uses the "x" flag, then the length is computed after parsing out any comments or whitespace. Unfortunately the use of descriptive (and therefore longish) variable names can cause regexps to be in violation of this policy, so interpolated variables are counted as 4 characters no matter how long their names actually are. CASE STUDY
As an example, look at the regexp used to match email addresses in Email::Valid::Loose (tweaked lightly to wrap for POD) (?x-ism:(?:[^(40)<>@,;:".\[]00-37x80-xff]+(?![^(40)<>@,;:".\[] 00-37x80-xff])|"[^\x80-xff 15"]*(?:\[^x80-xff][^\x80-xff 15 "]*)*")(?:(?:[^(40)<>@,;:".\[]00-37x80-xff]+(?![^(40)<>@,;:".\[ ]00-37x80-xff])|"[^\x80-xff 15"]*(?:\[^x80-xff][^\x80-xff 15"]*)*")|.)*@(?:[^(40)<>@,;:".\[]00-37x80-xff]+(?![^(40)<>@, ;:".\[]00-37x80-xff])|[(?:[^\x80-xff 15[]]|\[^x80-xff])*] )(?:.(?:[^(40)<>@,;:".\[]00-37x80-xff]+(?![^(40)<>@,;:".\[]00 -37x80-xff])|[(?:[^\x80-xff 15[]]|\[^x80-xff])*]))*) which is constructed from the following code: my $esc = '\\'; my $period = '.'; my $space = '40'; my $open_br = '['; my $close_br = ']'; my $nonASCII = 'x80-xff'; my $ctrl = '00-37'; my $cr_list = ' 15'; my $qtext = qq/[^$esc$nonASCII$cr_list"]/; # " my $dtext = qq/[^$esc$nonASCII$cr_list$open_br$close_br]/; my $quoted_pair = qq<$esc>.qq<[^$nonASCII]>; my $atom_char = qq/[^($space)<>@,;:".$esc$open_br$close_br$ctrl$nonASCII]/;# " my $atom = qq<$atom_char+(?!$atom_char)>; my $quoted_str = qq<"$qtext*(?:$quoted_pair$qtext*)*">; # " my $word = qq<(?:$atom|$quoted_str)>; my $domain_ref = $atom; my $domain_lit = qq<$open_br(?:$dtext|$quoted_pair)*$close_br>; my $sub_domain = qq<(?:$domain_ref|$domain_lit)>; my $domain = qq<$sub_domain(?:$period$sub_domain)*>; my $local_part = qq<$word(?:$word|$period)*>; # This part is modified $Addr_spec_re = qr<$local_part@$domain>; If you read the code from bottom to top, it is quite readable. And, you can even see the one violation of RFC822 that Tatsuhiko Miyagawa deliberately put into Email::Valid::Loose to allow periods. Look for the "|." in the upper regexp to see that same deviation. One could certainly argue that the top regexp could be re-written more legibly with "m//x" and comments. But the bottom version is self- documenting and, for example, doesn't repeat "x80-xff" 18 times. Furthermore, it's much easier to compare the second version against the source BNF grammar in RFC 822 to judge whether the implementation is sound even before running tests. CONFIGURATION
This policy allows regexps up to "N" characters long, where "N" defaults to 60. You can override this to set it to a different number with the "max_characters" setting. To do this, put entries in a .perlcriticrc file like this: [RegularExpressions::ProhibitComplexRegexes] max_characters = 40 CREDITS
Initial development of this policy was supported by a grant from the Perl Foundation. AUTHOR
Chris Dolan <cdolan@cpan.org> COPYRIGHT
Copyright (c) 2007-2011 Chris Dolan. Many rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module perl v5.14.2 2012-06-0Perl::Critic::Policy::RegularExpressions::ProhibitComplexRegexes(3pm)
All times are GMT -4. The time now is 03:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy