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
  • 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Is MSDN subscription the answer? 4 52
How does Redux fit into React? 3 66
Doubt. 2 55
powershell command to get a dll version remotely for many server 12 11
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…

914 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

16 Experts available now in Live!

Get 1:1 Help Now