12-15-2011
nvm, misunderstood
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a script I am runing on a hacked CDLinux live CD called from /etc/rc.d/rc.local.
The part of th script in question goes like this.
When run from rc.local the prompt "Centre name :" and the colour change does not appear until after I type the input text and press return. Also, I... (2 Replies)
Discussion started by: simonb
2 Replies
2. Shell Programming and Scripting
Let a script needs a variable to execute. For example if i run ./test.sh then it needs a variable as there is a <STDIN> in the script. I want to execute it as in command line.
Let test.sh requires a variable name $number I want to execute it by
>test number <enter>
how is it possible? (1 Reply)
Discussion started by: shoeb
1 Replies
3. UNIX for Dummies Questions & Answers
Hi,
I've set up a script so that a user answers questions, and then these answers come back onto the screen accompanied by text that I've echoed. Is there a way of putting this into a new file?
Thanks (7 Replies)
Discussion started by: likelylad
7 Replies
4. Shell Programming and Scripting
Hello,
I'm running a bash script and I'd like to get more accurate a runtime information then now.
So far I've been using this method:
STARTM=`date -u "+%s"`
.........
*script function....
.........
STOPM=`date -u "+%s"`
RUNTIMEM=`expr $STOPM - $STARTM`
if (($RUNTIMEM>59)); then... (6 Replies)
Discussion started by: TehOne
6 Replies
5. Shell Programming and Scripting
Hello,
can someone please help me to fix this script,
I have a 2 files, one file has hostname information and second file has console information of the hosts in each line, I have written a script which actually reads each line in hostname file and should grep in the console file and paste the... (8 Replies)
Discussion started by: bobby320
8 Replies
6. Shell Programming and Scripting
Hi
I need help with my coding , first time I'm working with bash .
What i must do is check if there is 3 .txt files if there is not 3 of them i must give an error code , if al three is there i must first arrange them in alphabetical order and then take the last word in al 3 of the .txt files... (1 Reply)
Discussion started by: linux newb
1 Replies
7. Shell Programming and Scripting
I'm running cygwin bash on windows 7 and I'm have some bat files that perform large builds and take a long time and a lot of memory.
Therefor, I don't want to builds executing simultaneously (too much memory).
How can I implement a queue so I can queue up multiple builds and only execute one... (2 Replies)
Discussion started by: siegfried
2 Replies
8. Programming
I have built a site in PHP for radio station, and the daily schedule is displayed dynamically using PHP script.
I have added links to view different days but when it loads up its just loading up a new page. I can't quite remember how I done it but I'd like it to be in ajax if that's... (2 Replies)
Discussion started by: AimyThomas
2 Replies
9. Shell Programming and Scripting
Hi all,
here's my script
#!/bin/ksh
if
then
export DB_CREATE_PATH=`pwd`
fi
echo
echo "********************--Menu--*****************************"
echo "*** "
echo "*** 1. Pre-Upgrade Steps "... (3 Replies)
Discussion started by: jediwannabe
3 Replies
10. Shell Programming and Scripting
I have a BASH script that runs a continuous loop, reading a line from a file, and then spawning a background process to use it. I've placed "date" commands inside it to see where it's slowing down, and everything inside -- including reading the line from the file -- is fast, but the loop bogs... (34 Replies)
Discussion started by: gmark99
34 Replies
LEARN ABOUT DEBIAN
perl::critic::policy::regularexpressions::prohibitescapedmetacha
Perl::Critic::Policy::RegularExpressions::ProhibitEscapeUseraContributPerl::Critic::Policy::RegularExpressions::ProhibitEscapedMetacharacters(3pm)
NAME
Perl::Critic::Policy::RegularExpressions::ProhibitEscapedMetacharacters - Use character classes for literal meta-characters instead of
escapes.
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
Ever heard of leaning toothpick syndrome? That comes from writing regular expressions that match on characters that are significant in
regular expressions. For example, the expression to match four forward slashes looks like:
m//////;
Well, this policy doesn't solve that problem (write it as "m{////}" instead!) but solves a related one. As seen above, the escapes make
the expression hard to parse visually. One solution is to use character classes. You see, inside of character classes, the only
characters that are special are "", "]", "^" and "-", so you don't need to escape the others. So instead of the following loose IPv4
address matcher:
m/ d+ . d+ . d+ . d+ /x;
You could write:
m/ d+ [.] d+ [.] d+ [.] d+ /x;
which is certainly more readable, if less recognizable prior the publication of Perl Best Practices. (Of course, you should really use
Regexp::Common::net to match IPv4 addresses!)
Specifically, this policy forbids backslashes immediately prior to the following characters:
{ } ( ) . * + ? | #
We make special exception for "$" because "/[$]/" turns into "/[5.008006/" for Perl 5.8.6. We also make an exception for "^" because it
has special meaning (negation) in a character class. Finally, "[" and "]" are exempt, of course, because they are awkward to represent in
character classes.
Note that this policy does not forbid unnecessary escaping. So go ahead and (pointlessly) escape "!" characters.
CONFIGURATION
This Policy is not configurable except for the standard options.
BUGS
Perl treats "m/[#]/x" in unexpected ways. I think it's a bug in Perl itself, but am not 100% sure that I have not simply misunderstood...
This part makes sense:
"#f" =~ m/[#]f/x; # match
"#f" =~ m/[#]a/x; # no match
This doesn't:
$qr = qr/f/;
"#f" =~ m/[#]$qr/x; # no match
Neither does this:
print qr/[#]$qr/x; # yields '(?x-ism:[#]$qr
)'
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 20Perl::Critic::Policy::RegularExpressions::ProhibitEscapedMetacharacters(3pm)