Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


want to use a script with netrc

Posted on 2007-11-25
Medium Priority
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....
Question by:rpmindtools
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 40

Expert Comment

ID: 20346505

Very interesting links:

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


Author Comment

ID: 20346508
Do you have an example.
LVL 40

Accepted Solution

omarfarid earned 2000 total points
ID: 20346547

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 login mylogin password mypass macdef
lcd /appl/fp/merge
cd /appx/data/50/XFR/Data
put TRXFER.dat

Here when you


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 login whatever password pass macdef
prompt off

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

Author Closing Comment

ID: 31410874

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, As I have seen there a lot of requests regarding monitoring and reporting for exchange 2007 / 2010 / 2013 I have decided to post some thoughts together and link to articles that have helped me. Of course a lot of information you can get…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

688 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