Comments (10)
@poma hi, i'm having some little troubles with this, first, i couldn't ever change my shell to zsh with chsh command, so i start my outbash.exe with ~ -c "zsh --login"
, so i'm entering to the bash case, because my $SHELL variable is "/bin/bash", then i changed it to command_not_found_handler() to get it properly working, but the thing is that the if statement of try_cbwin gets executed and throws an error because is trying to find a "which" file, if i change it to $COMMAND "$1"
then i get the command executed twice, my question is, is this only happening to me because i didn't change the shell properly? and if you could walk me through that if statement on what is doing, i don't really know that much about shell scripting, i know this > /dev/null 2>&1
is for redirect the error output(right?xd), but the first part and what is the which for, no clue, i would really like to have this working and also add support, eventually, for the case of been on the home_directory and automatically append the :
for using windows_home_path in those cases, thanks in advance, regards!
from cbwin.
Try sudo chsh -s /bin/zsh yourUser
The idea of this script is to run which
command in windows shell to determine if a file (first argument) exists. We are not interested in its output (hence > /dev/null 2>&1
), we just need the return code. If it succeeds then run the whole command in windows. Obviously it will work only for executables and not built-in cmd commands.
I've just realized that my script uses which
command provided by Cygwin and that's why it doesn't work on your machine. The windows equivalent for which
is where
. I've fixed my script to reflect that.
from cbwin.
Also updated script to allow commands from home dir (false by default) but be careful with it
from cbwin.
thanks man! works perfect!! i couldn't be happier right now, i really appreciated, chsh in the other hand, still not working, i just change "command_not_found_handle" to "handler" for now, if it becomes a problem in the future, so it be lol, thanks again man and take care, regards!
PD: time to delete all those aliases =)
from cbwin.
Cool script! Any idea if Ctrl-Z can be made to work properly with it? Oddly suspension is propagated to the win32 side but I don't get back the shell prompt (tried with bash)
from cbwin.
Update about Ctrl-Z: hm and it's not just because of the use of a function and not even because of the use of command_not_found_handle. Weird. I will take another look later.
from cbwin.
Found a bug: this script will override default command-not-found script that suggests to install packages when command is not found (enabled in bash by default and in zsh via command-not-found
plugin). Updated my script to copy and invoke old function if it is defined. Also I've missed quotes around @$ in first version. Result is a bit verbose and probably still has some bugs as I have no experience with bash
from cbwin.
@xilun Ctrl-Z works for me. I can successfully freeze notepad, get shell prompt, and then unfreeze it.
from cbwin.
More testing: with this command not found handler, Ctrl-Z works under zsh, but not bash. This might be a bash bug or a WSL bug, I'm looking into it.
from cbwin.
This seems to be mainly a bash bug, however the behavior of bash is actually worse on a real Linux system in this case (Ctrl-C after a Ctrl-Z does not work), so there might also be a WSL bug (which in this case slightly improves the usability) to find in there :p
from cbwin.
Related Issues (20)
- wrun: can't translate a WSL VolFs path to a Win32 one HOT 7
- some win32 console programs "sometimes" do line feed instead of new line, but a workaround seems possible HOT 1
- a cmd-like behavior distinguishing between console / GUI target programs might be useful HOT 1
- backgrounded & force redirected caller => SIGTTIN
- Use double quotes to prevent word splitting may be better HOT 12
- Problem with arguments containing the character "&" HOT 1
- wcmd cmd no longer laggy, but eats characters HOT 1
- Let cbwin in session mode launch multiple wcmd instances in parallel HOT 11
- sockets for redirections are not using any security HOT 6
- wstart /mnt/c/windows does not work HOT 7
- Not work inside zsh HOT 14
- behavior of environment variable inconsistent in regards to case sensitivity HOT 1
- No terminal support HOT 6
- Vagrant output doesn't wrap correctly HOT 4
- interactive win32 console programs are broken (input and output) HOT 5
- Native Windows support for launching Windows applications HOT 1
- Some inputted characters skipped in Docker interactive terminal HOT 1
- Starting parameters for bash.exe
- Can't remove cbwin from my pc HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cbwin.