Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Shell script

Reply
Thread Tools

Shell script

 
 
Shabam
Guest
Posts: n/a
 
      09-27-2005
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.


 
Reply With Quote
 
 
 
 
Tad McClellan
Guest
Posts: n/a
 
      09-28-2005

[ Newsgroups trimmed.
I don't participate in the alt.* hierarchy and comp.lang.perl
was removed many years ago.
]


Shabam <(E-Mail Removed)> 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
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
 
 
 
Shea Martin
Guest
Posts: n/a
 
      11-10-2005
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
 
Reply With Quote
 
Michael Zawrotny
Guest
Posts: n/a
 
      11-10-2005
[ follow-ups trimmed to clpm ]

On Thu, 10 Nov 2005 14:36:26 GMT, Shea Martin <null@void.0> 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.
http://www.devshed.com/c/a/Perl/Gett...plate-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: (E-Mail Removed)
Tallahassee, FL 32306-4380 | phone: (850) 644-0069
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using subprocess module to launch a shell shell script that itselfforks a process Samuel A. Falvo II Python 0 10-08-2008 12:43 AM
Re: How to pass shell variable to shell script from python D'Arcy J.M. Cain Python 0 02-27-2008 01:56 PM
Re: How to pass shell variable to shell script from python Gerardo Herzig Python 1 02-27-2008 12:19 PM
Re: How to pass shell variable to shell script from python Christian Heimes Python 0 02-27-2008 10:53 AM
execute a shell script in a shell script moongeegee Perl Misc 2 12-04-2007 12:18 AM



Advertisments