Shell script
am 28.09.2005 00:10:29 von Shabam
Up to now I've been doing this manually via the command shell. However I'm
sure I can automate this using a script with better results. Can someone
show me how I can do this?
cp -pr /site/template/user /site/j/jason
cp -p /site/data/j/jason.dat /site/data/j/jason.dat; pico -w
/site/data/j/jason.dat
In pico I'm basically changing the first 3 lines, replacing the first line
with user "jason"s email, second with his name, and third with his zip code.
I'm trying to come up with a script that will take the username, email,
name, and zip code as arguments. Once done it will perform the above steps
and be done. Can someone perhaps help me with this? I've dabbled in some
Perl, but mostly by editting what's already been made. Thanks.
Re: Shell script
am 28.09.2005 00:22:34 von Sherm Pendley
"Shabam" writes:
> Up to now I've been doing this manually via the command shell. However I'm
> sure I can automate this using a script with better results. Can someone
> show me how I can do this?
>
> cp -pr /site/template/user /site/j/jason
> cp -p /site/data/j/jason.dat /site/data/j/jason.dat; pico -w
> /site/data/j/jason.dat
>
> In pico I'm basically changing the first 3 lines, replacing the first line
> with user "jason"s email, second with his name, and third with his zip code.
>
> I'm trying to come up with a script that will take the username, email,
> name, and zip code as arguments. Once done it will perform the above steps
> and be done. Can someone perhaps help me with this?
What have you tried so far? Give it your best shot, then post questions here
if you get stuck.
If you need some help learning the language and getting started, have a look
at .
Followups trimmed - comp.lang.perl was deactivated years ago.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
Re: Shell script
am 28.09.2005 00:22:34 von Sherm Pendley
"Shabam" writes:
> Up to now I've been doing this manually via the command shell. However I'm
> sure I can automate this using a script with better results. Can someone
> show me how I can do this?
>
> cp -pr /site/template/user /site/j/jason
> cp -p /site/data/j/jason.dat /site/data/j/jason.dat; pico -w
> /site/data/j/jason.dat
>
> In pico I'm basically changing the first 3 lines, replacing the first line
> with user "jason"s email, second with his name, and third with his zip code.
>
> I'm trying to come up with a script that will take the username, email,
> name, and zip code as arguments. Once done it will perform the above steps
> and be done. Can someone perhaps help me with this?
What have you tried so far? Give it your best shot, then post questions here
if you get stuck.
If you need some help learning the language and getting started, have a look
at .
Followups trimmed - comp.lang.perl was deactivated years ago.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
Re: Shell script
am 28.09.2005 14:35:08 von Tad McClellan
[ Newsgroups trimmed.
I don't participate in the alt.* hierarchy and comp.lang.perl
was removed many years ago.
]
Shabam wrote:
> I'm trying to come up with a script that will take the username, email,
> name, and zip code as arguments.
The command line arguments are available in the @ARGV array.
perldoc perlvar
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
Re: Shell script
am 10.11.2005 15:36:26 von shea martin
Shabam wrote:
> Up to now I've been doing this manually via the command shell. However I'm
> sure I can automate this using a script with better results. Can someone
> show me how I can do this?
>
> cp -pr /site/template/user /site/j/jason
> cp -p /site/data/j/jason.dat /site/data/j/jason.dat; pico -w
> /site/data/j/jason.dat
>
> In pico I'm basically changing the first 3 lines, replacing the first line
> with user "jason"s email, second with his name, and third with his zip code.
>
> I'm trying to come up with a script that will take the username, email,
> name, and zip code as arguments. Once done it will perform the above steps
> and be done. Can someone perhaps help me with this? I've dabbled in some
> Perl, but mostly by editting what's already been made. Thanks.
>
>
You could learn a minimal amount of perl/ruby/bash/python, then write a
short script to do all this for you. Actually, you could do it will
just the sed command if you are on unix. Thats what I would do.
~S
Re: Shell script
am 10.11.2005 15:36:26 von shea martin
Shabam wrote:
> Up to now I've been doing this manually via the command shell. However I'm
> sure I can automate this using a script with better results. Can someone
> show me how I can do this?
>
> cp -pr /site/template/user /site/j/jason
> cp -p /site/data/j/jason.dat /site/data/j/jason.dat; pico -w
> /site/data/j/jason.dat
>
> In pico I'm basically changing the first 3 lines, replacing the first line
> with user "jason"s email, second with his name, and third with his zip code.
>
> I'm trying to come up with a script that will take the username, email,
> name, and zip code as arguments. Once done it will perform the above steps
> and be done. Can someone perhaps help me with this? I've dabbled in some
> Perl, but mostly by editting what's already been made. Thanks.
>
>
You could learn a minimal amount of perl/ruby/bash/python, then write a
short script to do all this for you. Actually, you could do it will
just the sed command if you are on unix. Thats what I would do.
~S
Re: Shell script
am 10.11.2005 17:21:22 von Michael Zawrotny
[ follow-ups trimmed to clpm ]
On Thu, 10 Nov 2005 14:36:26 GMT, Shea Martin wrote:
> Shabam wrote:
> >
> > In pico I'm basically changing the first 3 lines, replacing the first line
> > with user "jason"s email, second with his name, and third with his zip code.
> >
> > I'm trying to come up with a script that will take the username, email,
> > name, and zip code as arguments. Once done it will perform the above steps
> > and be done. Can someone perhaps help me with this? I've dabbled in some
> > Perl, but mostly by editting what's already been made. Thanks.
>
> You could learn a minimal amount of perl/ruby/bash/python, then write a
> short script to do all this for you. Actually, you could do it will
> just the sed command if you are on unix. Thats what I would do.
I would use the Template Toolkit for this. You can setup the template
file and use the tpage program to generate the final version. There
are online tutorials (e.g.
www.devshed.com/c/a/Perl/Getting-Started-with-the-Perl-Templ ate-Toolkit/),
and the sample chapter of "Perl Template Toolkit" that O'Reilly has
graciously posted on the web
(http://www.oreilly.com/catalog/perltt/chapter/ch02.pdf) is probably
enough to get you through the job at hand.
One benefit to you is that you shouldn't need to write any code to use
TT.
Mike
--
Michael Zawrotny
Institute of Molecular Biophysics
Florida State University | email: zawrotny@sb.fsu.edu
Tallahassee, FL 32306-4380 | phone: (850) 644-0069