Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cmder bash script executing

I created basic script in Windows.

#!/bin/bash

echo Hello

I am using Cmder, ConEmu derivative. I tried to change the priviliges with chmod, but they are the same. I don't know how can I execute this script. Normal Linux way, which is: ./hello.sh does not work, and typing just hello.sh makes Windows try to open it, which is bad, since I want it in console. How to execute this script in ConEmu/Cmder?

like image 276
BadBot Avatar asked Mar 24 '16 08:03

BadBot


People also ask

Can Cmder run bash?

Some features of Cmder: Run linux bash, batch and powershell commands. Smooth text wrapping when window resizing.

What Shell does Cmder use?

Cmder uses Cmd.exe by default, but heavily customizes it – the actual interactive prompt that you see isn't a normal Cmd.exe prompt; it is shown by ConEmu's clink which gets injected into the Cmd process.

How do I run a bash script in CMD?

BASH will be available in the Command Prompt and PowerShell. Open Command Prompt and navigate to the folder where the script file is available. Type Bash script-filename.sh and hit the enter key. It will execute the script, and depending on the file, you should see an output.


Video Answer


2 Answers

I've noticed you can run bash from cmder. So I could do it like:

> bash
$ ./yourScript.sh

or simpler

> cat yourScript.sh | bash

Disclaimer: New to cmder (just downloaded it) and Linux myself.

like image 80
danicriss Avatar answered Oct 07 '22 10:10

danicriss


On my own instance of Cmder, bash [filename] works just fine, and I believe much simpler:

C:\Users\Conor O'Brien
λ type test.sh
echo Hello

C:\Users\Conor O'Brien
λ bash test.sh
Hello
like image 10
Conor O'Brien Avatar answered Oct 07 '22 10:10

Conor O'Brien