Solved

TFTP

Posted on 2008-06-25
2
510 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

910 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

23 Experts available now in Live!

Get 1:1 Help Now