0

I get this error:

Unknown .netrc keyword $download

The script reads:

machine **.gov
login anonymous
password none

macdef download
        cd  some directory
        quit

$ download
4
  • You are correct:
    – Barry
    Feb 11, 2021 at 15:57
  • The approach I now took (thank you to someone for a previous answer).
    – Barry
    Feb 11, 2021 at 15:57
  • I create a .netrc file with login information. I then add in a bash script file ftp ftp.my.site <<EOF (calling the .netrc file). Then add separate lines for ftp commands, and end with EOF
    – Barry
    Feb 11, 2021 at 15:58
  • I wrote it as an answer.
    – Archemar
    Feb 11, 2021 at 17:12

2 Answers 2

1

man 5 netrc make no provision for macro call, only macro defintion.

way to solve :

ftp prep.ai.mit.edu <<EOF
$ download
EOF

with

  • .netrc having login for prep.ai.mit.edu
  • $ download is actual call to macro defined in .netrc
0
1

man netrc writes,

If a macro named init is defined, it is automatically executed as the last step in the auto-login process

It looks like this is what you need,

machine WHATEVER.gov
login anonymous
password none

macdef init
        cd "/some/directory"
        get …whatever…
        quit

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .