tcsh - confusion with quoting

dsijams

New Member


Messages: 3

I am trying to execute the following in a shell script:

Code:
/usr/local/bin/wget -t 25 -o dwnldlog https://opendata.arcgis.com/datasets/c5caefe76b3c4a519711a8489f6def51_21.csv?where=DATE_REPT>=GETDATE()-44
The tcsh does not like () I can't figure how to quote the braces to make the command acceptable.

Thanks for any help.
 

tobik@

Daemon
Developer

Reaction score: 1,426
Messages: 1,909

Try putting the URL in single or double quotes:
/usr/local/bin/wget -t 25 -o dwnldlog "https://opendata.arcgis.com/datasets/c5caefe76b3c4a519711a8489f6def51_21.csv?where=DATE_REPT>=GETDATE()-44"
 

Minbari

Aspiring Daemon

Reaction score: 314
Messages: 576

Simple quotes should do the job:

Code:
 wget -t 25 -o dwnldlog 'https://...... '
 

poorandunlucky

Well-Known Member

Reaction score: 38
Messages: 372

tcsh is kinda painful to script with, especially for command redirection...

why don't you just write your scipt in sh? I use tcsh as an interactive shell, and i sometimes write stuff in tcsh for fun, because i like the syntax, but if it's anything useful, i write in sh, like everyone...

you just add a shebang to your file as such:

Code:
#!/bin/sh -

# This is a comment

var this="is a variable"

if [ condition ] then
statement
fi

# etc...  the man sh(8) is quite detailed, and i recommend you be wary of Internet pages and tutorials
# about sh because they replaced sh by bash in Linux, it's slightly different from sh on FreeBSD, and
# most people talk about Linux's symlink to bash when they write about sh.
 
OP
dsijams

dsijams

New Member


Messages: 3

The " " worked well, as suggested. However, now I am getting: HTTP request sent, awaiting response . . . 500 Internal Server Error
 

poorandunlucky

Well-Known Member

Reaction score: 38
Messages: 372

Yeah, I get that too...

To download the list of police report for the city of Tucson, AZ, if that's what you wanted to do, you should remove everything after the .csv.
 
OP
dsijams

dsijams

New Member


Messages: 3

Yes, I have successfully downloaded the whole file (167mb) by removing the filter code after the csv.
 
Top