Plankton has asked for the wisdom of the Perl Monks concerning the following question:
Friends,
I am trying to write a simple script that I could use while editting files with vi. One of the things I like about vi is that you can do things like :1,$ !program. Here's a demostration of what I want to be able to do ...
I am trying to write a simple script that I could use while editting files with vi. One of the things I like about vi is that you can do things like :1,$ !program. Here's a demostration of what I want to be able to do ...
In the above example I used sort to modify my file. I want to be able to do this with this script ...bash-2.05b$ vi junk NOTES doc backup notes scripts cpio_out bashrc ~ ~ ~ :1,$ !sort backup bashrc cpio_out doc notes NOTES scripts :wq
... but when I do something like this ...bash-2.05b$ cat twc #!/usr/bin/perl -w use strict; my $file = shift; if ( !defined( $file ) ) { print "usage: $0 <dir|file>\n"; exit 0; } if ( ! -e $file ) { print "#$file\n"; } else { print "$file\n"; }
... I get this ...bash-2.05b$ vi junk backup bashrc cpio_out doc notes NOTES scripts ~ ~ ~ :1,$ !./twc
How should I be handling the input in my Perl script?usage: ./twc <dir|file>
Plankton: 1% Evil, 99% Hot Gas. |
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: making my script work with vi
by Paladin (Vicar) on Jul 15, 2004 at 18:13 UTC | |
Re: making my script work with vi
by gmax (Abbot) on Jul 15, 2004 at 18:18 UTC | |
Re: making my script work with vi
by etcshadow (Priest) on Jul 15, 2004 at 19:59 UTC | |
Re: making my script work with vi
by dave_the_m (Monsignor) on Jul 15, 2004 at 18:15 UTC | |
Re: making my script work with vi
by NovMonk (Chaplain) on Jul 15, 2004 at 18:22 UTC | |
Re: making my script work with vi
by ninja_byte (Acolyte) on Jul 19, 2004 at 21:44 UTC |
Back to
Seekers of Perl Wisdom