Live data from Hacker News

The Beauty of Unix Pipelines

prithu.xyz

361–370 of 388 posts

Re: The Beauty of Unix Pipelines

#361

Earlier quoted context omitted.

Ditto. For projects where I must work in Windows my secret weapon is WSL + tmux + fish + vim for everything without a strict Visual Studio dependency.

hard to get around not using the mouse eventually when looking up docs or copy pasting from browser

Unfortunately. But that's what VI keybindings for the browser are for!

Re: The Beauty of Unix Pipelines

#362

Earlier quoted context omitted.

hard to get around not using the mouse eventually when looking up docs or copy pasting from browser

Unfortunately. But that's what VI keybindings for the browser are for!

I personally don't mind using the mouse here and there in vim.

Re: The Beauty of Unix Pipelines

#363

Earlier quoted context omitted.

I agree that all of them so far seem to be lacking in many ways compared to PowerShell, but saying they are "nothing like" PowerShell isn't a very accurate statement in my opinion.

No, that is totally accurate - there is nothing even close to PowerShell. You were inaccurate on the other hand - what is similar to PowerShell ?

Structured object piping, for one. What is this thread about again? Oh right, piping.

Re: The Beauty of Unix Pipelines

#365

Earlier quoted context omitted.

The shell works with spaces, you just need to be careful to quote every file name. The advantage of using file names without spaces is that you can avoid the quotes.

Please don't ever assume you can avoid spaces and quotes. It's just a time bomb. It's like people saying you don't need to escape SQL values because they come from constants. Yes, they do... today. It's not just quoting either. It's setting the separator value and reverting it correctly. It's making sure you're still correct when you're in a function in an undefined state. It's a lot of overhead in larger projects.

What I am saying is nothing new. This has always been the policy of UNIX developers. If you use only file names without space, then you can make it easier to use tools that depend on this. Of course, if you're writing applications in shell then you cannot rely just on convention.

Re: The Beauty of Unix Pipelines

#366
post #109

Earlier quoted context omitted.

Try finding out which registry key you need to edit to get something to happen. Some things across different systems have pitfalls as a result of their implementation, or some features have pitfalls. There are half a dozen things I can point to on windows that are worse than the "spaces in filenames". Hell, windows doesn't even support ISO 8601 dates, or times to be properly placed in files. It restricts symbols much…

who said anything about windows?

The parent thread referenced windows as something that handles spaces in filenames. I'm not sure why I'm getting downvoted when my comment was relevant to the debate occurring, and my point (that all features have downfalls caused by the necessity of implementation within the surrounding system, and in the case of command line arguments, linguistics and common keyboards themselves) is something that according to the guidelines should be debated against, not downvoted.

Re: The Beauty of Unix Pipelines

#367
post #366

Earlier quoted context omitted.

who said anything about windows?

The parent thread referenced windows as something that handles spaces in filenames. I'm not sure why I'm getting downvoted when my comment was relevant to the debate occurring, and my point (that all features have downfalls caused by the necessity of implementation within the surrounding system, and in the case of command line arguments, linguistics and common keyboards themselves) is something that according to the…

None of the parents of your comment mentioned Windows. Perhaps you have the wrong thread?

Re: The Beauty of Unix Pipelines

#368

Earlier quoted context omitted.

Ditto. For projects where I must work in Windows my secret weapon is WSL + tmux + fish + vim for everything without a strict Visual Studio dependency.

hard to get around not using the mouse eventually when looking up docs or copy pasting from browser

Yes, that’s a pain point I haven’t quite cracked.

Copy-paste within tmux works just fine with (a) set -g mouse on in ~/.tmux.conf (b) mouse select to copy and (c) Ctrl + B ] to paste.

Copy-paste from tmux to Windows or vice versa is a pain.

I haven’t tried all the terminals yet but what I need is an iTerm2 [1] for Windows.

[1]: https://iterm2.com

Re: The Beauty of Unix Pipelines

#369
post #98

Earlier quoted context omitted.

I have never come across a NodeJS script instead of a shell script. Can you suggest an example to look at that shows the advantages of this?

Here's a JS script [1] I wrote a little while ago just for my own use that queries the CDC for the latest virus numbers, then calcs the average, formats the data and prints to the command line. You can pass in a number of days, otherwise it pulls the last 14 days. $ node query-cdc.js 7 It's nothing special, but I wouldn't want to try to do this with command line utilities. (And yes, it was a bit uglier, but I cleaned…

Thanks, appreciated! I guess using shebang #!/usr/bin/node does not work as # is not a valid comment?

Re: The Beauty of Unix Pipelines

#370
post #148
post #99

Earlier quoted context omitted.

It replaces the executable in the current process with a different executable. It's kind of like spawning a new process with an executable, except it's the same PID, and file descriptors without CLOEXEC remain open in their original state.

whats a simple example of using this?

see here: https://pubs.opengroup.org/onlinepubs/9699919799/functions/e...

plenty of basic examples with execv, execve, execvp, etc.

if the execv() call succeed then it completely replaces the program running in the process that calls it

you can do plenty of tricks with that ;)

Post reply on HN