Skip to content

Instantly share code, notes, and snippets.

@havocesp
Last active August 26, 2018 22:41
Show Gist options
  • Save havocesp/1eec156c5227de6a2770eb3ca0769872 to your computer and use it in GitHub Desktop.
Save havocesp/1eec156c5227de6a2770eb3ca0769872 to your computer and use it in GitHub Desktop.
Download file from url if exists, otherwise return non-zero value to system.
function ftp_get(){
ftp -V "$1"
}
@havocesp
Copy link
Author

Using command ftp with URL file as argument assures either remote file copy or an error (non-zero value return).

Otherwise, other commands like wget, under somre situations wille read html response and output it as file returning a zero value to system so we get undesired file with a non error return.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment