How to script wget in bash?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to script wget in bash?
# 1  
Old 12-25-2007
How to script wget in bash?

The script below is giving me grief! The error message says

Code:
/download.bash: line 16: syntax error near unexpected token `else'
./download.bash: line 16: `else wget "http://downloads.sourceforge.net/hibernate/hibernate-3.2.5.ga.zip?modtime=1185893922&big_mirror=1"
'

I think it must be a problem with the special characters in the URL. Can some make this script work?
Thanks,
Siegfried

Code:
#!/usr/bin/bash
#
# Begin commands to execute this file using bash with bash
# chmod +x download.bash
# ./download.bash
# End commands to execute this file using bash with bash
#
# $Log: download.bash,v $
# Revision 1.1  2007/12/25 05:48:31  Administrator
# Initial revision
#
#
if [ -e hibernate-3.2.5.ga.zip ]
then
echo "already got hibernate-3.2.5.ga.zip"
else wget "http://downloads.sourceforge.net/hibernate/hibernate-3.2.5.ga.zip?modtime=1185893922&big_mirror=1"
fi

# 2  
Old 12-25-2007
Works for me. Possibly a control character showed up when you copied the URL. Copy your forum text into a new script to see.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies

2. Shell Programming and Scripting

Wget - working in browser but cannot download from wget

Hi, I need to download a zip file from my the below US govt link. https://www.sam.gov/SAMPortal/extractfiledownload?role=WW&version=SAM&filename=SAM_PUBLIC_MONTHLY_20160207.ZIP I only have wget utility installed on the server. When I use the below command, I am getting error 403... (2 Replies)
Discussion started by: Prasannag87
2 Replies

3. Shell Programming and Scripting

Store filenames for wget in bash

I have a bash that downloads a list of files as a text file using wget. What I now need to do is store those files names and pass them to a download call also using wget. List.txt in /home directory FilterDuplicates.html file1.bam file2.bam file3.bam file1.vcf.gz file2.vcf.gz... (3 Replies)
Discussion started by: cmccabe
3 Replies

4. Shell Programming and Scripting

Wget in bash using sed and awk

In the bash below when the program is opened the download function runs and downloads the getCSV file and on the screen "Downloading getCSV.csv:%" displays and when it completes the menu function is called. However, as of now the bash opens and closes after a few seconds and I'm not sure... (4 Replies)
Discussion started by: cmccabe
4 Replies

5. Shell Programming and Scripting

Wget in bash

I am attempting to write a bash that starts by using wget and getting the following errors: Stand-alone code that works: wget -O getCSV.txt http://172.24.xxx.xxx/data/getCSV.csv c:\cygwin\home\cmccabe\NGS.sh: line 2: $'\r': command not found : No such file or directorysh: line 3:... (2 Replies)
Discussion started by: cmccabe
2 Replies

6. Shell Programming and Scripting

BASH scripting - Preventing wget messed downloaded files

hello. How can I detect within script, that the downloaded file had not a correct size. linux:~ # wget --limit-rate=20k --ignore-length -O /Software_Downloaded/MULTIMEDIA_ADDON/skype-4.1.0.20-suse.i586.rpm ... (6 Replies)
Discussion started by: jcdole
6 Replies

7. Shell Programming and Scripting

wget won't from script

I am trying to use wget to capture a web page on the Internet. If I use the command from a terminal like: wget Whidbey Island, Naval Air Station WA Weather -O /tmp/FIL.tmp it works but if I use it in a bash script the size of /tmp/FIL.tmp is zero. Can someone help me. Should I not be using... (5 Replies)
Discussion started by: slak0
5 Replies

8. Shell Programming and Scripting

Using wget in a Perl script

Hi, I've written a script in Perl that generates a URL and prints it. So if I run the script from the command line, I get something like this: $ script.pl http://www.url.com/folder/file.extI would like to use this script with wget to download the file at the URL generated. Is there a simple... (2 Replies)
Discussion started by: Altay_H
2 Replies

9. Shell Programming and Scripting

help with wget script.

#!/bin/sh # 'clear' for i in $(seq -w 15 37) do echo $i echo The content in Z Z=`wget --dns-timeout=0.001 http://napdweb${i}.eao.abn-iad.ea.com:8000/webcore/test/test.jsp` echo $Z A="Connection timed out." echo The content in A echo $A expr "$A" : '..\(...\)' echo $A done ... (3 Replies)
Discussion started by: veerumahanthi41
3 Replies

10. Shell Programming and Scripting

Script to download file using wget

Hi I need a Shell script that will download a text file every second from a http server using wget. Can anyone provide me any pointers or sample scripts that will help me go about this task ??? regards techie (1 Reply)
Discussion started by: techie82
1 Replies
Login or Register to Ask a Question