Earlier quoted context omitted.
>A Sysadmin would take 5 minutes with a shitty language and a shitty tool and get way more done in less time. Most people aren't sysadmins, but occasionally have to do sysadmin-like things. I've been programming with python and go for years. I've never been able to get the "core" command line utilities to really stick in my head. A sysadmin uses them every day, whereas I rarely have to reach for them. On the rare occ…
>what was the flag I need for `find` again This is not on you, `find`'s command line syntax is awful even if you have to use it everyday.
Shell-ish scripting in Go with ease
31–40 of 68 posts
Re: Shell-ish scripting in Go with ease
#32pairing this with yaegi [1] would be interesting. You could having a REPL open doing os operations and when you get the data looking like you want, you select which lines to save to a file. [1] https://github.com/traefik/yaegi
Re: Shell-ish scripting in Go with ease
#33Earlier quoted context omitted.
Not OP, but the usual talking points were covered pretty well in this thread from yesterday: https://news.ycombinator.com/item?id=42884337 To sum it up, the biggest complaints are error handling, null handling, and dependency management. And y’know, being backed by a company of ghouls hellbent on extracting value for themselves at the expense of society.
dependency management in Go is best in class what are you talking about? go mod is that good.
go mod is the second best I've used for sure, but if someone releaed bundler-but-for-go I'd switch to it in a heartbeat.
Re: Shell-ish scripting in Go with ease
#34Earlier quoted context omitted.
>what was the flag I need for `find` again This is not on you, `find`'s command line syntax is awful even if you have to use it everyday.
And don’t forget GNU vs BSD version differences…
Re: Shell-ish scripting in Go with ease
#35Why shouldn't it be as easy to write system administration programs in Go as it is in a typical shell? 1. Shell scripting offers infinite functionality. You can shell script with any program in any language. All it needs to do is take input and produce output. And if the functionality doesn't exist, you can create it on the fly, without having to follow any of the traditional rules of programming. 2. Shell scripting…
The major reason shell scripting is nice is because its portable with a copy/paste and HelloWorld.sh doesn't need a compiler or a VM or even any preceding incantation to run.
As much as I hate that this is where my hopes are, I do hope that Powershell gets to a point where you can write single C# files and run them.
Re: Shell-ish scripting in Go with ease
#36Earlier quoted context omitted.
>A Sysadmin would take 5 minutes with a shitty language and a shitty tool and get way more done in less time. Most people aren't sysadmins, but occasionally have to do sysadmin-like things. I've been programming with python and go for years. I've never been able to get the "core" command line utilities to really stick in my head. A sysadmin uses them every day, whereas I rarely have to reach for them. On the rare occ…
>what was the flag I need for `find` again This is not on you, `find`'s command line syntax is awful even if you have to use it everyday.
What's awful about it?
Re: Shell-ish scripting in Go with ease
#37Why shouldn't it be as easy to write system administration programs in Go as it is in a typical shell? 1. Shell scripting offers infinite functionality. You can shell script with any program in any language. All it needs to do is take input and produce output. And if the functionality doesn't exist, you can create it on the fly, without having to follow any of the traditional rules of programming. 2. Shell scripting…
You can run a shell command from a language you like so they're just as flexible. Go and many other languages have Exec (or equivalent). The major reason shell scripting is nice is because its portable with a copy/paste and HelloWorld.sh doesn't need a compiler or a VM or even any preceding incantation to run. As much as I hate that this is where my hopes are, I do hope that Powershell gets to a point where you can w…
Together with intuitive function calling facility using Uniform Function Call Syntax or UFCS you can easily has natively compiled scripting environment [2],[3].
[1] Pragmatic D Tutorial:
https://qznc.github.io/d-tut/hello.html
[2] Why I use the D programming language for scripting (2021) (50 comments):
https://news.ycombinator.com/item?id=36928485
[3] Uniform Function Call Syntax:
Re: Shell-ish scripting in Go with ease
#38Re: Shell-ish scripting in Go with ease
#39Earlier quoted context omitted.
You can run a shell command from a language you like so they're just as flexible. Go and many other languages have Exec (or equivalent). The major reason shell scripting is nice is because its portable with a copy/paste and HelloWorld.sh doesn't need a compiler or a VM or even any preceding incantation to run. As much as I hate that this is where my hopes are, I do hope that Powershell gets to a point where you can w…
D language rdmd wrapper allows to compile-and-execute directly [1]. Together with intuitive function calling facility using Uniform Function Call Syntax or UFCS you can easily has natively compiled scripting environment [2],[3]. [1] Pragmatic D Tutorial: https://qznc.github.io/d-tut/hello.html [2] Why I use the D programming language for scripting (2021) (50 comments): https://news.ycombinator.com/item?id=36928485 [3…
Tcc has the `-run` flag for easily doing this with a normal-ish shebang.
With a nasty polyglot preamble of C and bash at the top of your file, you can do it with any compiler.
Re: Shell-ish scripting in Go with ease
#40Why shouldn't it be as easy to write system administration programs in Go as it is in a typical shell? 1. Shell scripting offers infinite functionality. You can shell script with any program in any language. All it needs to do is take input and produce output. And if the functionality doesn't exist, you can create it on the fly, without having to follow any of the traditional rules of programming. 2. Shell scripting…
>A Sysadmin would take 5 minutes with a shitty language and a shitty tool and get way more done in less time. Most people aren't sysadmins, but occasionally have to do sysadmin-like things. I've been programming with python and go for years. I've never been able to get the "core" command line utilities to really stick in my head. A sysadmin uses them every day, whereas I rarely have to reach for them. On the rare occ…
That, combined with reading the man pages if it doesn’t work first try has been really effective for me.