Solved

TFTP

Posted on 2008-06-25
2
515 Views
Last Modified: 2010-05-18
Hello,
I'm using Linux Fedora core -6.
Using one shell script I need to download one file from TFTP server.
Script should take IP address and file name with path.
ex. downloadFile.sh 10.10.10.10 /opt/config/file.txt

Can any body help me in writing such script.. specially tftp commands to use in script.

Thanks
0
Comment
Question by:pkgoyal
  • 2
2 Comments
 
LVL 14

Accepted Solution

by:
agriesser earned 125 total points
ID: 21868702
Give this one a try.
#!/bin/sh
 
if [ "$#" != "2" ]; then
  echo "usage: $(basename $0) <tftp-server> <remote-file-name>"
  exit 1
fi
 
if echo "get $2 $(basename $2)" | tftp $1 2>&1 | grep -qi "Error code"; then
  exit 1
fi
 
exit 0

Open in new window

0
 
LVL 14

Expert Comment

by:agriesser
ID: 21872167
Just out of interest: Why is a fully functional script just graded with a B??
0

Featured Post

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

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

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

829 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