-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[QUESTION] Scripts #2
Comments
Yeah, expanding on that point:
With the above in mind: yes, the language and syntax that you use in wzsh will also be readable from a file and look very much like bourne shell style syntax (in fact, starting in 437d3f5 your Not 100% related to your question, but another thing to consider is that the unix philosophy is to push a lot of the heavy lifting out of the shell and into utilities such as |
Hook up command line argument parsing (`wzsh -h` now does what you expect!) so that you can run a script: ``` $ echo ls > /tmp/foo.wzsh $ ./target/debug/wzsh /tmp/foo.wzsh [output from ls shows here] ``` There are probably things missing like correctly propagating the exit status from the script. Refs: #2
Honestly, the syntax is what matters most to me, ESPECIALLY the command substitution. In batch, the only way to assign the output of a command to a variable is a For the utilities, I could use something like busybox64.exe, which has a lot of utilities bundled into it, so I'd just be distributing wzsh.exe, busybox64.exe, and a script. I do hope wzsh will have it's own built-in version of Ideally, I'm hoping I can make a 'hybrid' command script that starts with the terminal and launches into wzsh, similar to the scripts in this thread. Since a shebang isn't going to be necessary I think, I'll be able to accomplish that like this: echo >/dev/null # >NUL & @echo off & goto:Batch
# Area for WZSH syntax script #
exit 0
:Batch
:: whatever batch commands need to run first for whatever reason
echo|set /p="butts"&echo/
:: then launching the wzsh script section up proper:
or echo >/dev/null # >NUL & @start /b wzsh.exe --script "%~s0" %* |
This allows `echo ls | wzsh` to run stdin as though it were a script. Refs: #2
I pushed a couple of quick commits that make it easier to play with the state of scripting as it exists today. It is still pretty early and rough feeling right now! re: busybox, you could put something like this into your which -q busybox64.exe && ls() { busybox64 ls $* }
which -q busybox64.exe && grep() { busybox64 grep $* } (Ideally you'd just use a simple |
For the sake of making it easier to see without requiring you to build it, those commits allow this:
|
This comment has been minimized.
This comment has been minimized.
Also, something that functions like |
BTW, I hooked up very basic windows builds; the artifacts are captured in the github actions UI which you can get into by clicking here: https://github.com/wez/wzsh/actions From there you can select a build and then download the binary: I'll refine this a bit later, but this should be sufficient to easily play with the latest build, which has some basic scripting support now; see the top level readme for a checklist of the current status. |
Could you clarify what you mean here? https://github.com/wez/wzsh#non-goals
Batch is a horrible, horrible scripting language, and while PowerShell is much better in that regard, its backwards/forwards compatibility is wretched. And while WSL provides an easy way to utilize bash scripts for personal use, usually when I make a script it's for people who aren't so tech-savvy - which means WSL is typically out of the question. But, distributing a single binary inside of a zip file with a script, that's very doable.
Will some form of shell script through wzsh be possible?
The text was updated successfully, but these errors were encountered: