Skip to main content
replaced http://serverfault.com/ with https://serverfault.com/
Source Link

You've got 0 validation in there, so the slightest hiccup will halt your script halfway. That's fine for you, but for a user, there will be a script that runs, crashes along the way, and then leaves all sorts of junk lying about.

You also have a "warning" for an unknown OS version, but then the os version seems to be required - without it, mppkg won't make sense and it's likely that the download will fail (unless there is a standard file, MacPorts-someversion-.pkg?). You'd be better off exiting the script then and there. Fail fast.

Lastly, the two paired curl calls

curl $uridist/$mppkg.pkg -O
curl $uridist/$mpchk.chk.txt -O

Could be ran asynchronously (see this serverfault question http://serverfault.com/questions/456490/execute-curl-requests-in-parallel-in-bashhttps://serverfault.com/questions/456490/execute-curl-requests-in-parallel-in-bash) with & and wait. That way the script would be a bit faster.

You've got 0 validation in there, so the slightest hiccup will halt your script halfway. That's fine for you, but for a user, there will be a script that runs, crashes along the way, and then leaves all sorts of junk lying about.

You also have a "warning" for an unknown OS version, but then the os version seems to be required - without it, mppkg won't make sense and it's likely that the download will fail (unless there is a standard file, MacPorts-someversion-.pkg?). You'd be better off exiting the script then and there. Fail fast.

Lastly, the two paired curl calls

curl $uridist/$mppkg.pkg -O
curl $uridist/$mpchk.chk.txt -O

Could be ran asynchronously (see this serverfault question http://serverfault.com/questions/456490/execute-curl-requests-in-parallel-in-bash) with & and wait. That way the script would be a bit faster.

You've got 0 validation in there, so the slightest hiccup will halt your script halfway. That's fine for you, but for a user, there will be a script that runs, crashes along the way, and then leaves all sorts of junk lying about.

You also have a "warning" for an unknown OS version, but then the os version seems to be required - without it, mppkg won't make sense and it's likely that the download will fail (unless there is a standard file, MacPorts-someversion-.pkg?). You'd be better off exiting the script then and there. Fail fast.

Lastly, the two paired curl calls

curl $uridist/$mppkg.pkg -O
curl $uridist/$mpchk.chk.txt -O

Could be ran asynchronously (see this serverfault question https://serverfault.com/questions/456490/execute-curl-requests-in-parallel-in-bash) with & and wait. That way the script would be a bit faster.

async downloads
Source Link
Pimgd
  • 22.3k
  • 5
  • 66
  • 144

You've got 0 validation in there, so the slightest hiccup will halt your script halfway. That's fine for you, but for a user, there will be a script that runs, crashes along the way, and then leaves all sorts of junk lying about.

You also have a "warning" for an unknown OS version, but then the os version seems to be required - without it, mppkg won't make sense and it's likely that the download will fail (unless there is a standard file, MacPorts-someversion-.pkg?). You'd be better off exiting the script then and there. Fail fast.

Lastly, the two paired curl calls

curl $uridist/$mppkg.pkg -O
curl $uridist/$mpchk.chk.txt -O

Could be ran asynchronously (see this serverfault question http://serverfault.com/questions/456490/execute-curl-requests-in-parallel-in-bash) with & and wait. That way the script would be a bit faster.

You've got 0 validation in there, so the slightest hiccup will halt your script halfway. That's fine for you, but for a user, there will be a script that runs, crashes along the way, and then leaves all sorts of junk lying about.

You also have a "warning" for an unknown OS version, but then the os version seems to be required - without it, mppkg won't make sense and it's likely that the download will fail (unless there is a standard file, MacPorts-someversion-.pkg?). You'd be better off exiting the script then and there. Fail fast.

You've got 0 validation in there, so the slightest hiccup will halt your script halfway. That's fine for you, but for a user, there will be a script that runs, crashes along the way, and then leaves all sorts of junk lying about.

You also have a "warning" for an unknown OS version, but then the os version seems to be required - without it, mppkg won't make sense and it's likely that the download will fail (unless there is a standard file, MacPorts-someversion-.pkg?). You'd be better off exiting the script then and there. Fail fast.

Lastly, the two paired curl calls

curl $uridist/$mppkg.pkg -O
curl $uridist/$mpchk.chk.txt -O

Could be ran asynchronously (see this serverfault question http://serverfault.com/questions/456490/execute-curl-requests-in-parallel-in-bash) with & and wait. That way the script would be a bit faster.

Source Link
Pimgd
  • 22.3k
  • 5
  • 66
  • 144

You've got 0 validation in there, so the slightest hiccup will halt your script halfway. That's fine for you, but for a user, there will be a script that runs, crashes along the way, and then leaves all sorts of junk lying about.

You also have a "warning" for an unknown OS version, but then the os version seems to be required - without it, mppkg won't make sense and it's likely that the download will fail (unless there is a standard file, MacPorts-someversion-.pkg?). You'd be better off exiting the script then and there. Fail fast.