Author Topic: Yeah Yeah... OSX and GNU/UNIX tools in commandline  (Read 1946 times)

0 Members and 1 Guest are viewing this topic.

Offline iLLucionist

  • * Elevated Elder
  • Thread Starter
  • Posts: 2735
  • Location: Netherlands
  • Topre is Love.
Yeah Yeah... OSX and GNU/UNIX tools in commandline
« on: Mon, 24 April 2017, 09:39:46 »
Rant:

So people always say: buy Apple coz best of both worlds: MS Office + Adobe AND commandline tools.

But: OS X ALWAYS does things SO differently than your typical linux distribution.

For instance, I made a report generator that converts .svg to .pdf to include it in a latex template, that is then rendered and converted to pdf to form the final PDF.

Guess what... OS X terminal (bash? should be bash..) doesn't take "--" as a "iterate over all files for *.<extension>". No no... you have to use ugly bash for-loop.

WHY APPLE?

As a matter of fact, most of my "portable linux" code that relies on terminal commands ALWAYS needs to be slightly modified to work on OSX. OS X is even less compliant in terms of operators / prefixes for terminal commands than is *BSD.
MJT2 Browns o-rings - HHKB White - ES-87 Smoke White Clears - 87UB 55g

Offline dgneo

  • Supervillain
  • * Curator
  • Posts: 2182

Offline iLLucionist

  • * Elevated Elder
  • Thread Starter
  • Posts: 2735
  • Location: Netherlands
  • Topre is Love.
MJT2 Browns o-rings - HHKB White - ES-87 Smoke White Clears - 87UB 55g

Offline joey

  • Posts: 2296
  • Location: UK
Re: Yeah Yeah... OSX and GNU/UNIX tools in commandline
« Reply #3 on: Mon, 24 April 2017, 10:59:57 »
Rant:

So people always say: buy Apple coz best of both worlds: MS Office + Adobe AND commandline tools.

But: OS X ALWAYS does things SO differently than your typical linux distribution.

For instance, I made a report generator that converts .svg to .pdf to include it in a latex template, that is then rendered and converted to pdf to form the final PDF.

Guess what... OS X terminal (bash? should be bash..) doesn't take "--" as a "iterate over all files for *.<extension>". No no... you have to use ugly bash for-loop.

WHY APPLE?

As a matter of fact, most of my "portable linux" code that relies on terminal commands ALWAYS needs to be slightly modified to work on OSX. OS X is even less compliant in terms of operators / prefixes for terminal commands than is *BSD.

You could be writing bash code in Linux on a newer version of bash than OS X has.

What '--' are you talking about by the way?

Offline iLLucionist

  • * Elevated Elder
  • Thread Starter
  • Posts: 2735
  • Location: Netherlands
  • Topre is Love.
Re: Yeah Yeah... OSX and GNU/UNIX tools in commandline
« Reply #4 on: Mon, 24 April 2017, 11:07:58 »
Rant:

So people always say: buy Apple coz best of both worlds: MS Office + Adobe AND commandline tools.

But: OS X ALWAYS does things SO differently than your typical linux distribution.

For instance, I made a report generator that converts .svg to .pdf to include it in a latex template, that is then rendered and converted to pdf to form the final PDF.

Guess what... OS X terminal (bash? should be bash..) doesn't take "--" as a "iterate over all files for *.<extension>". No no... you have to use ugly bash for-loop.

WHY APPLE?

As a matter of fact, most of my "portable linux" code that relies on terminal commands ALWAYS needs to be slightly modified to work on OSX. OS X is even less compliant in terms of operators / prefixes for terminal commands than is *BSD.

You could be writing bash code in Linux on a newer version of bash than OS X has.

What '--' are you talking about by the way?

I was wrong, this is meant by the "--"-operator in a bash command:

https://unix.stackexchange.com/questions/11376/what-does-double-dash-mean-also-known-as-bare-double-dash

But still, for some reason, the default bash shell on OS X does not iteratively process files to a command when you supply it with "*.<ext>".
MJT2 Browns o-rings - HHKB White - ES-87 Smoke White Clears - 87UB 55g

Offline joey

  • Posts: 2296
  • Location: UK
Re: Yeah Yeah... OSX and GNU/UNIX tools in commandline
« Reply #5 on: Mon, 24 April 2017, 11:08:29 »
Rant:

So people always say: buy Apple coz best of both worlds: MS Office + Adobe AND commandline tools.

But: OS X ALWAYS does things SO differently than your typical linux distribution.

For instance, I made a report generator that converts .svg to .pdf to include it in a latex template, that is then rendered and converted to pdf to form the final PDF.

Guess what... OS X terminal (bash? should be bash..) doesn't take "--" as a "iterate over all files for *.<extension>". No no... you have to use ugly bash for-loop.

WHY APPLE?

As a matter of fact, most of my "portable linux" code that relies on terminal commands ALWAYS needs to be slightly modified to work on OSX. OS X is even less compliant in terms of operators / prefixes for terminal commands than is *BSD.

You could be writing bash code in Linux on a newer version of bash than OS X has.

What '--' are you talking about by the way?

I was wrong, this is meant by the "--"-operator in a bash command:

https://unix.stackexchange.com/questions/11376/what-does-double-dash-mean-also-known-as-bare-double-dash

But still, for some reason, the default bash shell on OS X does not iteratively process files to a command when you supply it with "*.<ext>".
Can you paste a full example of what you mean?

Offline iLLucionist

  • * Elevated Elder
  • Thread Starter
  • Posts: 2735
  • Location: Netherlands
  • Topre is Love.
Re: Yeah Yeah... OSX and GNU/UNIX tools in commandline
« Reply #6 on: Mon, 24 April 2017, 11:10:20 »
Rant:

So people always say: buy Apple coz best of both worlds: MS Office + Adobe AND commandline tools.

But: OS X ALWAYS does things SO differently than your typical linux distribution.

For instance, I made a report generator that converts .svg to .pdf to include it in a latex template, that is then rendered and converted to pdf to form the final PDF.

Guess what... OS X terminal (bash? should be bash..) doesn't take "--" as a "iterate over all files for *.<extension>". No no... you have to use ugly bash for-loop.

WHY APPLE?

As a matter of fact, most of my "portable linux" code that relies on terminal commands ALWAYS needs to be slightly modified to work on OSX. OS X is even less compliant in terms of operators / prefixes for terminal commands than is *BSD.

You could be writing bash code in Linux on a newer version of bash than OS X has.

What '--' are you talking about by the way?

I was wrong, this is meant by the "--"-operator in a bash command:

https://unix.stackexchange.com/questions/11376/what-does-double-dash-mean-also-known-as-bare-double-dash

But still, for some reason, the default bash shell on OS X does not iteratively process files to a command when you supply it with "*.<ext>".
Can you paste a full example of what you mean?

Burried in my Python 3.x module:

Code: [Select]
>>> os.system("mogrify -format pdf -- *.svg")
MJT2 Browns o-rings - HHKB White - ES-87 Smoke White Clears - 87UB 55g

Offline pattulus

  • Posts: 39
  • Location: Berlin
    • RocketINK
Re: Yeah Yeah... OSX and GNU/UNIX tools in commandline
« Reply #7 on: Tue, 25 April 2017, 13:43:47 »
I installed bash and some gnu utilities with brew on the Mac to fix this. Be aware of the "--with-default-names" option when you install it.

Offline iLLucionist

  • * Elevated Elder
  • Thread Starter
  • Posts: 2735
  • Location: Netherlands
  • Topre is Love.
Re: Yeah Yeah... OSX and GNU/UNIX tools in commandline
« Reply #8 on: Tue, 25 April 2017, 14:21:27 »
I installed bash and some gnu utilities with brew on the Mac to fix this. Be aware of the "--with-default-names" option when you install it.

Thanks, that's quite helpful!
MJT2 Browns o-rings - HHKB White - ES-87 Smoke White Clears - 87UB 55g