Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

TFTP

Posted on 2008-06-25
2
Medium Priority
?
521 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 14

Accepted Solution

by:
agriesser earned 375 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

Not sure which OpenStack Certification to get?

So you’ve realized you might want to get certified in OpenStack, but you’re not sure what the benefits might be or even which one you should take. You know there are several certification courses you can choose from, but how do you know which one is right for you?

Question has a verified solution.

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

Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
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…
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.
Suggested Courses

705 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