HI,
I’m new to my Mac. I love it, but, it’s definitely different than the
PCs I used for 20 years.
I’ve got some simple Ruby scripts that worked fine on my PC, but, they
don’t seem to work on my Mac.
Here’s one below. All it does it to use “curl” to pull some graphics
files from a distant database. My shell command would be something like:
orcagets.rb im197941.pdf im197963.pdf
if $orcafile1 =~ /^p/ then
puts “This first file is a p file.”
$prefix =
$orcafile1[/^([A-z,0-9]{1,15}p)([0-9]{1,5}).([A-z]{3,4})/]
$prefix = $1
$numeral1 = $2
$flavor = $3
$numeral2 = $orcafile2[/^[A-z,0-9]{1,15}p([0-9]{1,5}).[A-z]{3,4}/]
puts $numeral2
if $flavor == “tif” then
$flavor = “tiff”
$extension = “tif”
end
for i in $numeral1…$numeral2 curl -o #{$prefix}0#{i}.#{$flavor} #{$url}#{$flavor}/#{$prefix}0#{i} if i.to_i < 10 curl -o #{$prefix}#{i}.#{$flavor} #{$url}/#{$flavor}/#{$prefix}#{i} if i.to_i > 9
end
else
$prefix = $orcafile1[/^([A-z]{1,5})([0-9]{1,6}).([A-z]{3,4})/]
$prefix = $1
$numeral1 = $2
$flavor = $3
$extension = $3
$numeral2 = $orcafile2[/^[A-z]{1,5}([0-9]{1,6}).[A-z]{3,4}/]
$numeral2 = $1
puts $numeral2
if $flavor == “tif” then
$flavor = “tiff”
$extension = “tif”
end
for i in $numeral1…$numeral2 curl -o #{$prefix}#{i}.#{$extension} #{$url}/#{$flavor}/#{$prefix}#{i}
end
end
HI,
I’m new to my Mac. I love it, but, it’s definitely different than the
PCs I used for 20 years.
I’ve got some simple Ruby scripts that worked fine on my PC, but, they
don’t seem to work on my Mac.
Here’s one below. All it does it to use “curl” to pull some graphics
files from a distant database. My shell command would be something like:
orcagets.rb im197941.pdf im197963.pdf
I notice you’re not really using curl for anything complicated, so it
seems more fitting to use the standard Net::HTTP backend instead. Here
is a GitHub repository someone put together with example usage:
The reason I recommend this is because you don’t have to worry about
whether or not a machine has curl, and you also don’t have to worry
about shell parameter escaping since you’re dealing with a remote host.
Here. Can’t reproduce your error, Peter. I’d suggest you look at your
environment, not at the script.
kaspar
OK. I’ll poke around some more. Thanks.
Wow. I’m sorry. I found my problem. I’m so new to the Mac that I forgot,
when I saved my script in TextMate, to save it with Mac line endings. It
was still set to Windows. Sorry about that. Thanks for all your help,
everybody.