geekhack

geekhack Community => Off Topic => Topic started by: iLLucionist on Mon, 24 April 2017, 09:39:46

Title: Yeah Yeah... OSX and GNU/UNIX tools in commandline
Post by: iLLucionist 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.
Title: Re: Yeah Yeah... OSX and GNU/UNIX tools in commandline
Post by: dgneo on Mon, 24 April 2017, 10:51:21
https://geekhack.org/index.php?topic=50202.0
Title: Re: Yeah Yeah... OSX and GNU/UNIX tools in commandline
Post by: iLLucionist on Mon, 24 April 2017, 10:57:55
https://geekhack.org/index.php?topic=50202.0

Good point, will take it over there.
Title: Re: Yeah Yeah... OSX and GNU/UNIX tools in commandline
Post by: joey 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?
Title: Re: Yeah Yeah... OSX and GNU/UNIX tools in commandline
Post by: iLLucionist 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 (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>".
Title: Re: Yeah Yeah... OSX and GNU/UNIX tools in commandline
Post by: joey 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 (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?
Title: Re: Yeah Yeah... OSX and GNU/UNIX tools in commandline
Post by: iLLucionist 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 (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")
Title: Re: Yeah Yeah... OSX and GNU/UNIX tools in commandline
Post by: pattulus 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.
Title: Re: Yeah Yeah... OSX and GNU/UNIX tools in commandline
Post by: iLLucionist 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!