Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: BASH for Window 10 - Will you?  (Read 3555 times)

0 Members and 1 Guest are viewing this topic.

Geek-9pm

    Topic Starter

    Mastermind
  • Geek After Dark
  • Thanked: 1026
    • Gekk9pm bnlog
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
BASH for Window 10 - Will you?
« on: May 21, 2017, 04:43:24 PM »
Well, I haven't - so I am asking.
Link below is from Jan 10, 2017.
http://www.infoworld.com/article/3155994/microsoft-windows/bash-on-windows-is-becoming-microsofts-linux.html
Quote
A massive set of changes to the Windows Subsystem for Linux (WSL) was rolled into Windows Insider build 15002, which started shipping to Windows 10 users yesterday.
Microsoft’s plans for WSL remain mainly provisional and experimental, but the company is improving and expanding WSL at the pace of a first-class feature. If this is any hint, Microsoft’s goal is nothing short of making it a credible alternative to other Linux distributions.
More recent:
https://msdn.microsoft.com/en-us/commandline/wsl/about
Quote
Overview

Bash on Windows provides developers with a familiar Bash shell and Linux environment in which you can run most Linux command-line tools, directly on Windows, UNMODIFIED, without needing an entire Linux virtual machine!

Bash/WSL allows you to:

1.  Run common command-line utilities such as grep, sed, awk, etc.
2.    Use the Linux-compatible filesystem & hierarchy and access fixed Windows storage mounted under /mnt/...
3.    Run Bash shell scripts and Linux command-line apps. including
...
    Invoke Windows applications from within Bash
    Invoke Linux applications from within Windows!
The Microsoft Insall Guide
https://msdn.microsoft.com/en-us/commandline/wsl/install_guide
Quote
Jack Hammons|Last Updated: 5/8/2017
Important note
This is the first release of Bash on Windows and it is branded "beta" deliberately - it's not yet complete! You should expect many things to work and for some things to fail! We greatly appreciate you using Bash on Windows and helping us identify the issues we need to fix in order to deliver a great experience.

Prerequisites
    Your PC must be running (at a minimum) a 64-bit version of Windows 10 Anniversary Update. Creators Update is recommended.

    To find your PC's CPU architecture and Windows version/build number, open Settings>System>About. Look for the OS Build and System Type fields.

Is this important to you?  :)

Salmon Trout

  • Guest
Re: BASH for Window 10 - Will you?
« Reply #1 on: May 22, 2017, 01:49:29 AM »
"Will you?" - Have been since April 2016 on my laptop (Insider Builds), and since August 2016 on my mainstream machine (it came with Anniversary Update).

Since the Creators Update you have interops (interoperability) so you can do this in bash

Code: [Select]
/mnt/c/Windows/System32/cmd.exe /c dir
You can make the /mnt/c/Windows/System32/cmd.exe part into something shorter if you wish (having .bashrc on Windows! W00T!)

and in Windows command prompt you can do this

Code: [Select]
bash -c "ls -l"
These are just simple examples, of course. In each shell you can run the other shell's scripts and binaries... What's not to like?

I do find a lot of Linux command line stuff more intuitive and more rewarding to master, and (I feel like I am admitting something dirty here) I have never much liked Powershell. Yes, I know there has always been Cygwin, but I don't like that much either. I have a Linux box running Debian 8 Jessie and using WSL to provide an ssh terminal is very handy, also to my NAS running ARM Linux. I use Nano for my editor. All is good.


« Last Edit: May 22, 2017, 02:12:05 AM by Salmon Trout »

Salmon Trout

  • Guest
Re: BASH for Window 10 - Will you?
« Reply #2 on: May 22, 2017, 10:34:18 AM »

Code: [Select]
/mnt/c/Windows/System32/cmd.exe /c dir
You can make the /mnt/c/Windows/System32/cmd.exe part into something shorter if you wish (having .bashrc on Windows! W00T!)

In fact you can just use cmd.exe in bash, because the bash $PATH variable includes the Windows %path%

BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: BASH for Window 10 - Will you?
« Reply #3 on: May 22, 2017, 11:28:33 AM »
I don't have it enabled on most of my systems (maybe a few where I fiddled with it) and probably won't use it. Though it is good to know it is there. Could be useful for things like SSH like Salmon mentioned.

I definitely prefer Bash over powershell by a wide margin but generally prefer to do things the "Windows way" on windows and the "Linux Way" on Linux, and cmd tends to be enough on Windows, at least for me. Though there have been times I wanted a easily available Linux command or program and had to try to build a Windows version from source which was a pain which is made simple via this approach.
I was trying to dereference Null Pointers before it was cool.