leongrdic / wsl-alias Goto Github PK
View Code? Open in Web Editor NEWcreate aliases for Linux commands in Windows command line (for WSL)
License: MIT License
create aliases for Linux commands in Windows command line (for WSL)
License: MIT License
I find myself in the following situation.
Microsoft Windows [Version 10.0.17134.165]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\...> b
'b' is not recognized as an internal or external command,
operable program or batch file.
C:\...> b.bat
Welcome to wsl-alias! Put your environment variables in ~/.wsl/env.sh
If I move b.bat
to another directory that is on my path and outside the WSL file system, it can be found using just 'b'.
I already tried reinstalling a few times.
Did I miss something, or is PATHEXT not applicable to WSL directories (anymore)?
On my Windows, the real path to WSL is C:\Users\micha\AppData\Local\lxss\home\m93a\.wsl
, not %localappdata%\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\m93a\.wsl
as your program reports.
Hi,
I'm running v2.3 on Windows 10 x64 1803 with Debian installed in WSL and I installed wsl-alias using the provided installer. I've encountered several problems.
I've added an alias for php like this:
C:\Users\Me>b wsl-alias add php php
To verify it really is running from WSL:
C:\Users\Me>php -a
Interactive mode enabled
php > system("uname");
Linux
Running files using a relative path works:
C:\Users\Me>php Documents\Projects\test.php
Using a full path however, does not:
C:\Users\Me>php C:\Users\Me\Documents\Projects\test.php
Could not open input file: C:/Users/Me/Documents/Projects/test.php
Also, some special characters in arguments cause problems. Parantheses will not work:
C:\Users\Me>php -r "exit()"
/bin/bash: -c: line 0: syntax error near unexpected token `('
/bin/bash: -c: line 0: `~/.wsl-alias/wrapper.sh 'C:\\Users\\Me' php -r \"exit()\"'
Semicolons will also cause errors:
C:\Users\Me>php -r "exit;"
/home/me/.wsl-alias/wrapper.sh: eval: line 41: unexpected EOF while looking for matching `"'
/home/me/.wsl-alias/wrapper.sh: eval: line 42: syntax error: unexpected end of file
Let me know if I can be of any help.
EDIT: For clarification, running these commands without wsl-alias using only the native wsl, all special characters work:
C:\Users\Me>wsl php -r "printf('Test(\"Test\");');"
Test("Test");
important things to consider:
wslpath
to translate the windows path into the unix pathsince the fall update came out, there are a few things we should update
if anyone wants to contribute, I'd appreciate the help
I might not be doing this properly, but I tried to create an alias to an absolute path to a program and it threw an error.
C:\Users\cjk>b wsl-alias add node /home/offero/.nvm/versions/v8.15.0/bin/node
Unknown regexp modifier "/h" at -e line 1, at end of line
syntax error at -e line 1, near "/."
Execution of -e aborted due to compilation errors.
successfully added
Node is probably not the best example to do this with, but I'm sure there are others.
The install script does not wait for user input regarding the default alias:
$ curl -o- https://raw.githubusercontent.com/leongrdic/wsl-alias/master/install.sh | bash
...
Choose a command you'd like to use to call bash from Windows
Command [b]:
The installation has completed!
...
I did not enter an empty line there. (Tried a few times, to be sure.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.