1

After installing win-bash from sourceforge.net and creating a command prompt label and setting the path, my bash recognizes some commands like "ls", "mkdir" but not "clear" or "clean"!

the label to command prompt has this in its properties: k

the red arrows points to this setpath.bat, it has this:

@echo off
SET PATH=%PATH%;C:\win-bash
bash
exit

the folder win-bash has the content from win-bash downloaded file from sourceforge + setpath.bat file.

My bash recognizes ls, mkdir - creates folders, but can't "clean". What's the reason - some shell cmds recognized, and some don't?!

P.S. It does NOT recognize most commands - mkfile, lsblk, calendar(cal) e

ERJAN
  • 23,696
  • 23
  • 72
  • 146
  • While I don't know the cause (probably clear is not included in the win-bash implementation), you can set an alias for simple commands like `clear` to `cls` if nothing else works out. More here on setting alias https://stackoverflow.com/questions/20530996/aliases-in-windows-command-prompt –  Sep 15 '18 at 19:13
  • `clear` isn't part of bash *at all*, on any system; it's a command (optionally) provided by your OS itself. You can test this by running `type clear` on an operating system where it *is* an available command; if it said `clear is a shell builtin` or `clear is a shell keyword` that would mean the command was part of bash, but something like `clear is /usr/bin/clear` means it's a separate tool. – Charles Duffy Sep 15 '18 at 19:14
  • @CharlesDuffy, yes, i know but clean does not work either.. it s not working as normal bash! – ERJAN Sep 15 '18 at 19:21
  • 1
    Once again, it's not "normally" part of bash. Even when it's a command available on your OS, it's the OS that provides it, not bash, so whether it's available depends on whether the OS or otherwise something other-than-bash is providing that command (for example, with Cygwin installed on Windows, it's Cygwin -- not bash -- installing a copy of `clear`). Just installing bash doesn't install all the other commands that bash could potentially invoke on a real UNIX machine, and it's not reasonable to expect that it would. – Charles Duffy Sep 15 '18 at 19:23
  • @CharlesDuffy, i followed a utube tutorial, apparently it partially worked. What's the proper way of installing bash? I do have git-bash installed, but when I try to update NPM, it just freezes. Tell me pls - how do u have all that stuff installed? I have got NPM & node already installed. – ERJAN Sep 15 '18 at 19:25
  • what bash - zbash, csh, or other will have all normal Unix cmds we use? – ERJAN Sep 15 '18 at 19:26
  • This is bash, you installed the shell. The commands may or may not be a part of bash. [clear](https://linux.die.net/man/1/clear) is part of ncurses, not bash. Install ncurses for that, or compile clear program to have clear. What `clean` is? – KamilCuk Sep 15 '18 at 19:26
  • No shell -- not `csh`, not `zsh` (which is not "zbash" -- it's a completely different shell, and doesn't even try to have bash compatibility), nor any other -- will install non-shell commands. What you need is a distribution of UNIX tools like Cygwin, or -- even better -- a virtual machine with a *real* UNIX distro. Where to get those is off-topic here on SO -- see #4 in the "some questions are still off-topic" list at https://stackoverflow.com/help/on-topic – Charles Duffy Sep 15 '18 at 19:26
  • @CharlesDuffy, hmm I even installed cygwin, lol damn.. – ERJAN Sep 15 '18 at 19:30
  • @KamilCuk, thx u sir, clean is a 'typical' , 'std' command that I use to clean the screen of shell if it's cluttered with commands – ERJAN Sep 15 '18 at 19:30
  • Can you get it's source or any manual for the command? What standard are you referring to? – KamilCuk Sep 15 '18 at 19:31
  • Ahh, here we are: [How do I get the `clear` command in cygwin?](https://stackoverflow.com/questions/11249070/how-do-i-get-the-clear-command-in-cygwin) – Charles Duffy Sep 15 '18 at 19:31
  • @CharlesDuffy, no , like I said in the question - i used win-bash from sourceforge. – ERJAN Sep 15 '18 at 19:31
  • Right. Cygwin is a full distribution -- not just but the shell, but a whole bunch of surrounding tools. "win-bash" is... not. – Charles Duffy Sep 15 '18 at 19:32
  • @KamilCuk, it says "man - cmd not recognized" – ERJAN Sep 15 '18 at 19:33
  • @CharlesDuffy,when I installed cygwin I chose all the stuff.. let me check, or maybe delete&install cygwin again – ERJAN Sep 15 '18 at 19:33
  • I mean search for manual in the net, or any source. For the command `man` you need to install `man` or `man-db` or similar, as for any other command. `man` is a program, written in C, with source code available [here](https://github.com/giraldeau/man-db-2.6.3), the standard POSIX 1003.1 standarized `man` manual page available [here](http://pubs.opengroup.org/onlinepubs/9699919799/). It's not part of bash. – KamilCuk Sep 15 '18 at 19:39
  • @CharlesDuffy , ohh damn, seems like when I clicked "next" the default settings was "skip"? this is screenshot: http://prntscr.com/kutd5r – ERJAN Sep 15 '18 at 19:40
  • @KamilCuk, thx u i inspected my cygwin default installation - seems it just skipped stuff! here screenshot: http://prntscr.com/kutd5r – ERJAN Sep 15 '18 at 19:41

1 Answers1

1

Not an expert on win-bash, but here are some clues:

  • other linux emulators on Windows like mingw32, GoW provide standalone executable .exe for each program, so it is easy to see which commands are implemented just by reviewing the emulator directory (the one it appends to path)

  • win-bash claims from documentation it is a single-file replacement for the shell, but rest of documentation is limited

  • if you want to clear screen 'cls' should work it is a native windows command. On internals of 'clear' see https://superuser.com/questions/1161514/bash-on-ubuntu-on-windows-clearing-all-the-text-all-of-it

Evgeny
  • 4,173
  • 2
  • 19
  • 39
  • it's not that clean or clear is important - I want to have another shell, cuz git-bash is slow – ERJAN Sep 15 '18 at 19:47
  • 1
    You can also try 'cmder' - it is very nice console and it does install git bash when choosing the full option ( has clear command, btw). GoW is very lightweight set of utilities. Cygwin is deeper integration layer, but for my workflow git bash is perfect, cygwin was very heavy. – Evgeny Sep 15 '18 at 19:53