Solved

TFTP

Posted on 2008-06-25
2
505 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
Comment Utility
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
Comment Utility
Just out of interest: Why is a fully functional script just graded with a B??
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

762 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

13 Experts available now in Live!

Get 1:1 Help Now