want to use a script with netrc

Posted on 2007-11-25
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 500 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
BATCH to EXE Converter 2 99
Best print server for Mac + PC Environment 1 64
New-MoveRequest Exchange 2010 Powershell 1 56
Power Action 2 45
Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
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…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

734 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