I need to create a bash script that will work on a mac. It needs to download a ZIP file of a site and unzip it to a specific location.
curl -O
)unzip filename.zip path/to/save
)I need to make it so people can double-click the text file on their desktop and it will automatically run in terminal.
How do I make it so that the user can double click the icon on the desktop and it will run? What extension does the file need?
To extract the files from a ZIP file, use the unzip command, and provide the name of the ZIP file. Note that you do need to provide the “. zip” extension. As the files are extracted they are listed to the terminal window.
OSX uses the same GNU sh/bash as Linux
#!/bin/sh mkdir /tmp/some_tmp_dir && \ cd /tmp/some_tmp_dir && \ curl -sS http://foo.bar/filename.zip > file.zip && \ unzip file.zip && \ rm file.zip
the first line #!/bin/sh
is so called "shebang" line and is mandatory
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With