04-20-2011
@ DGPickett, could you explain what this construct does,
Quote:
Originally Posted by
DGPickett
I like "script_chain | read var_name" over "var+name=$( script chain )" over "var_name=`script_chain`", it just flows left to right, no unnecessary nesting.
Relative to the code posted. I just don't get it.
TIA.
10 More Discussions You Might Find Interesting
1. Solaris
Dear all,
Can you help me in copying files newer than speciifc date
Thanks in advance,
Rajesh (3 Replies)
Discussion started by: RAJESHKANNA
3 Replies
2. Shell Programming and Scripting
Hi
I am a shell-script newbie and am looking to synchronize certain files in two directory structures.
Both these directory-trees are in CVS and so I dont want the CVS directory to be copied over.
I want only .sh and .pl files in each subdirectory under these directory trees to be... (3 Replies)
Discussion started by: sharpsharkrocks
3 Replies
3. UNIX for Dummies Questions & Answers
Hey all,
I'm looking for a command that will search a directory (and all subdirectories) and give me a file count for the number of files that contain specific characters within its filename. e.g. I want to find the number of files that contain "-a.jpg" in their name.
All the searching I've... (6 Replies)
Discussion started by: murphysm
6 Replies
4. Shell Programming and Scripting
Hi Experts,
I want to know the count of specific word in a file. I have almost 600+ files.
So I want to loop thru each file and get the count of the specific word.
Please help me on achieving this...
Many thanks (2 Replies)
Discussion started by: elamurugu
2 Replies
5. Shell Programming and Scripting
I hope this isn't as silly as it sounds from the title of the thread.
I have software that outputs files where the name starts with a real number followed by underscore as a prefix to an input file name. These will list in the directory with the file with the smallest real number prefix as the... (5 Replies)
Discussion started by: LMHmedchem
5 Replies
6. Shell Programming and Scripting
Hi
I need to copy a huge directory with thousands of files onto another directory but without *.WMV files (and without *.wmv - perhaps we need to use *.).
Pls advise how can I do that.
Thanks (17 Replies)
Discussion started by: reddyr
17 Replies
7. Post Here to Contact Site Administrators and Moderators
Hi guys...please any one help me ....
how to copy files from source to target location
if 5 files copied successfully out of 10 files then implement success=10
and if remaining 5 files not copied successfully then count error=5
how to implement this condition with in loop
i need code linux... (0 Replies)
Discussion started by: sravanreddy
0 Replies
8. Shell Programming and Scripting
RootFolderI:
RootFolderI/FolderA/Subfolder1/Subsub1/JPG1.jpg -> want this jpg
RootFolderI/FolderA/Subfolder2/Subsub1/JPG2.jpg -> want this jpg
RootFolderI/FolderA/Subfolder2/Subsub2/JPG3.jpg
. . .
RootFolderI/FolderB/Subfolder1/Subsub1/JPG4.jpg -> want this jpg
... (1 Reply)
Discussion started by: blocnt
1 Replies
9. Shell Programming and Scripting
Hello All,
Since i'm relatively new in shell script need your guidance.
I'm copying files manually based on a specific word in a file name and its extension and then moving it into some destination folder.
so if filename contains hyr word and it has .md and .db extension; it will move to TUM/HYR... (13 Replies)
Discussion started by: prajaktaraut
13 Replies
10. Shell Programming and Scripting
Is it possible to only copy selected files+its directories when you are copying recursively?
find /OriginalFolder/* -type -d \{ -mtime 1 -o -mtime 2 \ } -exec cp -R {} /CopyTo/'hostname'__CopyTo/ \; -print
From the above line, I want to only copy *txt and *ini files from /OriginalFolder/*
... (4 Replies)
Discussion started by: apacheLinux
4 Replies
LEARN ABOUT OSX
padwalker5.16
PadWalker(3) User Contributed Perl Documentation PadWalker(3)
NAME
PadWalker - play with other peoples' lexical variables
SYNOPSIS
use PadWalker qw(peek_my peek_our peek_sub closed_over);
...
DESCRIPTION
PadWalker is a module which allows you to inspect (and even change!) lexical variables in any subroutine which called you. It will only
show those variables which are in scope at the point of the call.
PadWalker is particularly useful for debugging. It's even used by Perl's built-in debugger. (It can also be used for evil, of course.)
I wouldn't recommend using PadWalker directly in production code, but it's your call. Some of the modules that use PadWalker internally are
certainly safe for and useful in production.
peek_my LEVEL
peek_our LEVEL
The LEVEL argument is interpreted just like the argument to "caller". So peek_my(0) returns a reference to a hash of all the "my"
variables that are currently in scope; peek_my(1) returns a reference to a hash of all the "my" variables that are in scope at the
point where the current sub was called, and so on.
"peek_our" works in the same way, except that it lists the "our" variables rather than the "my" variables.
The hash associates each variable name with a reference to its value. The variable names include the sigil, so the variable $x is
represented by the string '$x'.
For example:
my $x = 12;
my $h = peek_my (0);
${$h->{'$x'}}++;
print $x; # prints 13
Or a more complex example:
sub increment_my_x {
my $h = peek_my (1);
${$h->{'$x'}}++;
}
my $x=5;
increment_my_x;
print $x; # prints 6
peek_sub SUB
The "peek_sub" routine takes a coderef as its argument, and returns a hash of the "my" variables used in that sub. The values will
usually be undefined unless the sub is in use (i.e. in the call-chain) at the time. On the other hand:
my $x = "Hello!";
my $r = peek_sub(sub {$x})->{'$x'};
print "$$r
"; # prints 'Hello!'
If the sub defines several "my" variables with the same name, you'll get the last one. I don't know of any use for "peek_sub" that
isn't broken as a result of this, and it will probably be deprecated in a future version in favour of some alternative interface.
closed_over SUB
"closed_over" is similar to "peek_sub", except that it only lists the "my" variables which are used in the subroutine but defined
outside: in other words, the variables which it closes over. This does have reasonable uses: see Data::Dump::Streamer, for example (a
future version of which may in fact use "closed_over").
set_closed_over SUB, HASH_REF
"set_closed_over" reassigns the pad variables that are closed over by the subroutine.
The second argument is a hash of references, much like the one returned from "closed_over".
var_name LEVEL, VAR_REF
var_name SUB, VAR_REF
"var_name(sub, var_ref)" returns the name of the variable referred to by "var_ref", provided it is a "my" variable used in the sub. The
"sub" parameter can be either a CODE reference or a number. If it's a number, it's treated the same way as the argument to "peek_my".
For example,
my $foo;
print var_name(0, $foo); # prints '$foo'
sub my_name {
return var_name(1, shift);
}
print my_name($foo); # ditto
AUTHOR
Robin Houston <robin@cpan.org>
With contributions from Richard Soberberg, Jesse Luehrs and Yuval Kogman, bug-spotting from Peter Scott, Dave Mitchell and Goro Fuji, and
suggestions from demerphq.
SEE ALSO
Devel::LexAlias, Devel::Caller, Sub::Parameters
COPYRIGHT
Copyright (c) 2000-2009, Robin Houston. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified
under the same terms as Perl itself.
perl v5.16.2 2012-08-24 PadWalker(3)