Earlier quoted context omitted.
With PowerShell level of slowness it starts to matter. Even very basic commands seem to sometimes take many seconds to run. In the middle of intense workflow it becomes a problem.
Care to give examples? I know that the language isn't fast, but afaik nearly all shells are interpreted. There have been performance problems with break/continue in earlier versions as they were implemented using exceptions internally. But that doesn't really qualify as "basic commands", I guess. Cmdlets should be not much slower than running the equivalent C# code yourself.
Batsh – A language that compiles to Bash and Windows Batch
111–120 of 130 posts
Re: Batsh – A language that compiles to Bash and Windows Batch
#112Earlier quoted context omitted.
You have that guarantee starting with Windows 7. Version is one thing; some nice things are available only in v3+, but v2 is very usable already. Execution policy is another matter, but you can always supply a batch file with the PowerShell script containing powershell -ExecutionPolicy Bypass -NoProfile -File %~dp0.ps1 %* That's what I usually do, which is also helpful for colleagues who have no idea how to run a Pow…
| You have that guarantee starting with Windows 7. Version is one thing; some nice things are available only in v3+, but v2 is very usable already. I love me some Powershell. Wrote my first non-trivial PS script in early 2010 that was a major component to building something I would now call "Continuous deployment of Windows OS images." But I still have way more lines of BAT in production than PS1 because the versioni…
However, I find myself using the new parameter sets for Where-Object very infrequently. Since they can only model
Property -Operator Value
their use is limited to certain operations, which I find myself to need not that often. And if the conditions get more complex I need to write a scriptblock anyway, having to refactor your former form into the latter.Re: Batsh – A language that compiles to Bash and Windows Batch
#113This is great for me. As part of my day job I am often stuck writing batch scripts (yes, in 2014) for clients that refuse to run powershell. Writing a simple batch script is usually not a problem, but it can be very encumbering as the complexity increases. Thank you for sharing.
Is VBScript/JScript not an option? It should be on every machine you come into contact with.
Re: Batsh – A language that compiles to Bash and Windows Batch
#114One peculiarity of batch files, and how cmd.exe executes them is that they are being read over and over (or maybe they are simply mapped file). I've found this by trial-and-error - while I was editing a batch file that was executing, it would suddenly error out with meaningless info, sometimes it'll print out the things I've just added to it.
Try this:
$ echo 'echo hello; sleep 2' >/tmp/hm.sh; bash /tmp/hm.sh & (sleep 1; echo 'ls /bin' >>/tmp/hm.sh); sleep 3Re: Batsh – A language that compiles to Bash and Windows Batch
#115Earlier quoted context omitted.
This eludes me but why care about the performance of a shell scripting language?
With PowerShell level of slowness it starts to matter. Even very basic commands seem to sometimes take many seconds to run. In the middle of intense workflow it becomes a problem.
Currently, "many seconds" is enough time to run an interpreter on the command, connect to a remote machine in Iceland, spin up a new virtual server there, send the command there to be executed, review the execution results for possible exceptions, run a malware scan, fetch the response back, execute the command again on your computer, translate the command and results to Klingon, send them to NSA for archiving, play a quick game of chess with another instance of the shell, and play a congratulatory tune.
Seriously, computers nowadays are fast enough to run a partial compile of your code at every single keystroke while you're writing it. It takes special effort to make a scripting language unusably slow - even an unoptimized interpreter that itself runs on a different interpreter should do just fine.
Re: Batsh – A language that compiles to Bash and Windows Batch
#116So I like the idea of a cleaner higher level version of BASH that still works like BASH but doesn't have the baggage of it's evolution. Key feature has to be output that is no less readable than the average bash script. Which it seems to be.
Re: Batsh – A language that compiles to Bash and Windows Batch
#117For everything since XP though, I and my team strongly prefer PowerShell. Once you grasp the logic of PS it, in my opinion, crushes every other scripting language that has ever been native to Windows. We routinely pull in .NET libraries for third party software to automate them as well. And the out of the box WMI support makes system administration tasks a snap.
All that said, batch scripts are still absolutely needed for some purposes and applications. There is no way around that until the last XP and 2003 boxes go to the great window in the sky...
Re: Batsh – A language that compiles to Bash and Windows Batch
#118Re: Batsh – A language that compiles to Bash and Windows Batch
#119This implementation is not perfect, although it's interesting that it supports Windows. I personally don't care about that, but it brings the idea to create some sugary wrapper around Bash that allows you to use Bash v4 features such as associative arrays in Bash v3, and wrappers that allow functions to return arrays and other typical headaches.
My initial thought after seeing this is Windows support is interesting, but the real value is in making bash friendlier. Something that brings syntactic sugar to bash is welcome in my mind, as I always find myself putzing with Google to find solutions to even slightly non-trivial scripts. Perhaps I should just master bash scripting once and for all (I know it's not that complex), but I generally find it unpleasant to…
This could be very easy. If this can't be rigged with simple shell scripting (in a reasonable way), then it could with straightforward changes to the compiler (such as outputting to standard output). If you don't mind doing somewhat silly things like writing out scripts as temp files, this could certainly be done now.
Re: Batsh – A language that compiles to Bash and Windows Batch
#120Earlier quoted context omitted.
Care to give examples? I know that the language isn't fast, but afaik nearly all shells are interpreted. There have been performance problems with break/continue in earlier versions as they were implemented using exceptions internally. But that doesn't really qualify as "basic commands", I guess. Cmdlets should be not much slower than running the equivalent C# code yourself.
Hmm, I can't seem to reproduce many such issues with this machine, except Get-Help the first time I tried it. I think it could be that the cmdlets are only slow on the first run (enough to leave me with a bad experience), or the SSD on my PC masks the problem. It's good to know that it's not always super slow.