Solved

want to use a script with netrc

Posted on 2007-11-25
4
1,092 Views
Last Modified: 2013-12-02
Hi I want to use a script with netrc . When ever i login using netrc i want to run some automatic script  ie change the directory ftp the file from remote system etc....
0
Comment
Question by:rpmindtools
  • 2
  • 2
4 Comments
 
LVL 40

Expert Comment

by:omarfarid
ID: 20346505
Hi,

Very interesting links:

http://aplawrence.com/Unixart/scripting_ftp.html
http://pwet.fr/man/linux/formats/netrc

Both suggest the use of init macro to do what you want.

0
 

Author Comment

by:rpmindtools
ID: 20346508
Do you have an example.
0
 
LVL 40

Accepted Solution

by:
omarfarid earned 500 total points
ID: 20346547
Hi,

The links provided have good examples. I will repeat them here:

in your ~/.netrc (in your home dir and have 600 as the file perms - chmod 600 ~/.netrc)

- example 1

machine somewhere.com login mylogin password mypass macdef
init
lcd /appl/fp/merge
cd /appx/data/50/XFR/Data
put artrx.tab TRXFER.dat
quit

Here when you

ftp somewhere.com

the login user name is mylogin
the password is mypass

and the init macro is executed after the successful login.
it change local and remote directories and put a file and quit

- example 2

machine someothermachine.org login whatever password pass macdef
init
hash
bin
prompt off

The 2nd example will run the commands hash , bin , and prompt off and then wait for your next command
0
 

Author Closing Comment

by:rpmindtools
ID: 31410874
Thanks
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
Preface There are many applications where some computing systems need have their system clocks running synchronized within a small margin and eventually need to be in sync with the global time. There are different solutions for this, i.e. the W3…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now