Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
06-20-2012, 09:24 AM
|
#1
|
Member
Registered: Jan 2008
Location: Pune
Distribution: RHEL,fedora
Posts: 253
Rep:
|
Need help with writing a c shell script?
Hi All,
I want to write a C/perl shell script but I am not sure exactly to go about writing it.This is what how I can expalin you what the script should exactly do.You need not tell me the code but just point me in the direction and tell me the commands that I can use
I have a directory structure where actually the code resides.different file types are in different folders.The basic idea is as follows
When I run the script it should tar the files in the folder them.
Then it should ftp the file to an ip address that I give in a command then it should untar the file in a particular directory structure that is similar to the one that I have tared the file.this I should ideally be able to do in a single shell script.
Please let me know how I can go about writing the script.
Thanks for all your inputs.
Last edited by Ajit Gunge; 06-20-2012 at 09:31 AM.
|
|
|
06-20-2012, 10:42 AM
|
#2
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
Terminology:
A "shell script" is normally written in the language of the shell. Otherwise you'll simply be writing a "Perl Script"---etc.
As for "C script"--I don't know what that would be---unless it were a shell script running in the "C Shell"
to write the actual script, start by trying all the individual commands. The first thing that jumps out at me is I am not sure that "tar" is available in the ftp protocol. (Uncle Google will know.....)
Next, if you start an ftp client during your script, then you need a way of passing ftp commands to ftp---I assume it's possible, but I've never seen the procedure.
|
|
|
06-20-2012, 10:53 AM
|
#3
|
Member
Registered: Jan 2008
Location: Pune
Distribution: RHEL,fedora
Posts: 253
Original Poster
Rep:
|
Thanks Pixellany.That should get me started
I guess I will write the script in a perl.I want to pass my PWD output as a tar argument.Can you tell me how can I do that in perl.
I quick search in uncle google gave me this link.
|
|
|
06-20-2012, 12:50 PM
|
#4
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
Quote:
I want to pass my PWD output as a tar argument.
|
Put the output of PWD into a variable, then expand the variable as part of the tar statement---use quoting rules as required.
Quote:
Can you tell me how can I do that in perl.
|
No
Why not just use BASH?----I don't know PERL, so I'm not really qualified to be asking you this......
|
|
|
06-20-2012, 01:33 PM
|
#5
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,273
|
probably a single rsync command will do this job, you only need to find out the flags you want to use.
__________________________________
Happy with solution ... mark as SOLVED
If someone helps you, or you approve of what's posted, click the "Add to Reputation" button, on the left of the post.
|
|
|
All times are GMT -5. The time now is 09:51 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|