1

I am working under Windows 10 and am putting together a few data-files and a simple bash-script that I want to share with Mac-Users. (I am just learning MacOS, so may have drawn wrong conclusions somewhere...)

When I tried to use that stuff on a Mac, the script would not execute after unzipping and I needed to set its attributes to allow execution. Is it possible to do that already under windows so that the file unzips with desired attributes set?

  • I haven't used Windows in too many years; however, I understand there is a Windows Subsystem for Linux available. Is this what you're using for your bash scripts? If yes, how are you zipping the script(s), via command line or GUI? If by the GUI, I'd try running a command line version of zip for Linux to see if it will retain the executable attribute. – user3439894 Sep 2 '19 at 16:50
  • No no, I'm working on "pure Windows" and have just written the script with a text-editor. It's not supposed to be used unser Windows, it's just borne there because that happens to be my development-environment. But while the script ise useless under window, I want unzipping user to be able to use it immediately, – MBaas Sep 2 '19 at 17:05
  • 1
    I'm talking about a Windows 10 feature: Have a look at Everything You Can Do With Windows 10’s New Bash Shell and https://www.howtogeek.com/265900/everything-you-can-do-with-windows-10s-new-bash-shell/. If doing it by the command line using a Linux zip under the Windows Subsystem for Linux. Another suggestion is to run Linux via Virtual Machine and do it there. – user3439894 Sep 2 '19 at 17:27
  • 1
    A zipped bash executable from a Linux Virtual Machine will be executable on macOS when unzipped. – user3439894 Sep 2 '19 at 17:27
  • Oh sorry, I hadn't realised that. That sounds promising indeed. Feel free to post that as a reply, than I accept it and close the question :) – MBaas Sep 2 '19 at 17:49
0

I haven't used Windows in to many years; however, I understand there is a new Windows 10 feature called Windows Subsystem for Linux. Have a look at Everything You Can Do With Windows 10’s New Bash Shell and How to Install and Use the Linux Bash Shell on Windows 10. Maybe using this feature will enable one to create and zip a bash executable and retain its attributes once unzipped on a Mac. I haven't tested it, so this is more informational then a working answer.

There are quite a few steps in the two linked articles and so as not to make this a so called link only answer, since I'm not quoting any of the steps, let me tell you something you can do from Windows that will work for sure...

Install Linux in a Virtual Machine and do your scripting, make it executable, and zip it up in the Linux VM. A zipped bash executable from a Linux Virtual Machine will be executable on macOS when unzipped.

| improve this answer | |
  • -1. First you propose an answer "I haven't tested it" and then as a second attempt propose setting the flags in Linux VM when the question was how to do it in Windows. If you are adding your flags in a different OS you may as well do it in macOS. – lx07 Sep 2 '19 at 20:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .