Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with OSX default getopt #12

Closed
kornysietsma opened this issue Mar 22, 2018 · 2 comments
Closed

Doesn't work with OSX default getopt #12

kornysietsma opened this issue Mar 22, 2018 · 2 comments

Comments

@kornysietsma
Copy link

kornysietsma commented Mar 22, 2018

OSX comes with non-gnu versions of getopt, sed and stat, which cause this script to behave badly - help doesn't work, some commands do work, but it does things like create folders called --options in your drive!

You can work around this by running brew install coreutils gnu-sed gnu-getopt
and then following the instructions to put the gnu getopt in your path:

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc

You'll also need to modify upload.sh to use gstat instead of stat and gsed instead of sed, unless you are willing to force your system to use gnu utils by default, as described in https://apple.stackexchange.com/questions/69223/how-to-replace-mac-os-x-utilities-with-gnu-core-utilities

@Narendra-WAL
Copy link

I made the changes as mentioned above. But still the file is not getting uploaded. Script is not able to find the fileName when this command is used
./upload.sh -v -r <google-folder-id> <file/directory-path>

I have hardcoded the fileName in upload.sh. Then file is getting uploaded to a folder with name --options, rather than the desired folder. And I don't even have access to that --options folder. I am just able to see this newly uploaded file in 'Recent files'.

@robert7
Copy link

robert7 commented Jan 6, 2020

I use this script on linux and its very useful. Recently I tried on OSX (macOS 10.15) and ist dosesn't work, as few used utilities (getopt, stat and sed) which are per default available on OSX work a bit differently.
Here is quick fix:
1, install gnu utilities brew install coreutils gnu-sed gnu-getopt
2, at the begin of tjhe upload.sh insert PATH="/usr/local/opt/coreutils/libexec/gnubin:/usr/local/opt/gnu-getopt/bin:/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"

Then in works..
(There is no need to modify default PATH, as this may have unwanted side effects)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants