6

I want to script the download of a file without having to enter tftp's command prompt. I've found that I can sort of achieve this with a here-document:

tftp 192.168.1.2 69 << _EOF_
  get testfile
  quit
_EOF

But I was hoping for something simpler, and closer to something as follows:

wget 192.168.1.2:69:/tftpboot/testfile
Bilesh Ganguly
  • 1,049
  • 1
  • 7
  • 16
tarabyte
  • 2,585

2 Answers2

4

You probably have the Linux NetKit TFTP client.

H. Peter Anvin's TFTP client (in the tftp-hpa package in Debian) has a command line option -c that does what you want:

-c command

Execute command as if it had been entered on the tftp prompt. Must be specified last on the command line.

Example:

tftp -m binary  "localhost"  -c get "pxelinux.0"
Toby Speight
  • 5,213
2

Try this tftp -g -r <filename> <ip-addr> replace filename and ip-addr

sebastienvg
  • 296
  • 1
  • 5