Intro to Shell - raisercostin/software-wiki GitHub Wiki
- windows: (cmd, powershell, win10 bash) + toybox + cmder
- linux: (bash, zsh) + toybox
- osx:
- original
- cmd - old DOS commands
- zsh - advanced and modern shell in linux
- bash - ubiquitous shell in linux
- powershell - advanced, modern, objectual but microsoft-lockin for windows
- general dynamic interpreted languages
- perl - cross platform
- python - cross platform
- ruby - cross platform
- grovy - cross platform, on JVM
- new, experimental
- kotlin
-
kscript
- best for now 2018-12-01 - https://github.com/holgerbrandl/kscript -
https://discuss.kotlinlang.org/t/executing-kotlin-scripts-in-command-shell/1926/3
sample.kts
to be executed withkotlinc -script sample.kts ..
#!/usr/bin/env kotlinc -script import java.io.File val folders: Array<out File> = File(args[0]).listFiles { file -> file.isDirectory }!! folders.forEach { folder -> println(folder) }
-
Kotlin version 1.3.10-release-253 (JRE 1.8.0_192-b12)
still not supporting - https://github.com/Kotlin/KEEP/blob/scripting/proposals/scripting-support.md - https://kotlinlang.org/docs/tutorials/command-line.html
-
- scala
- kotlin
- https://lucasfcosta.com/2019/02/10/terminal-guide-2019.html
- windows: cmder
- linux: term
- osx: iTerm2
- See https://stackoverflow.com/posts/53572628/revisions
- If not sure what is your shell try:
echo $0
-
minGW - MinGW (Minimalist GNU for Windows), formerly mingw32, is a free and open source software development environment to create Microsoft Windows applications. The development of the original MinGW project was halted in 2013, but an alternative called MinGW-w64 has been created by a different author to include several new APIs and provide 64-bit support.
- https://en.wikipedia.org/wiki/MinGW
- install:
scoop install cmder
- comes with
cmder
->vendor/git-for-windows
->bash
- comes with
- much better and shorter than cygwin
- can run
sdkman
- https://sdkman.io/install - can run bash scripts
- no package manager?
- can run
- msys - MSYS is a collection of GNU utilities such as bash, make, gawk and grep to allow building of applications and programs which depend on traditionally UNIX tools to be present. It is intended to supplement MinGW and the deficiencies of the cmd shell. A common misunderstanding is MSYS is "UNIX on Windows", MSYS by itself does not contain a compiler or a C library, therefore does not give the ability to magically port UNIX programs over to Windows nor does it provide any UNIX specific functionality like case-sensitive filenames. Users looking for such functionality should look to Cygwin or Microsoft's Interix instead.
- msys2
- install:
scoop install msys2
- https://github.com/klane/dotfiles/blob/master/install.ps1
- http://www.msys2.org/
- based on minGW and modern cygwin
- uses
pacman
as package managerpacman -S mc
- install:
-
gow - Gow (Gnu On Windows) is the lightweight alternative to Cygwin. It uses a convenient Windows installer that installs about 130 extremely useful open source UNIX applications compiled as native win32 binaries. It is designed to be as small as possible, about 10 MB, as opposed to Cygwin which can run well over 100 MB depending upon options.
- install:
scoop install gow
- https://github.com/bmatzelle/gow
- executables list - https://github.com/bmatzelle/gow/wiki/executables_list
- install:
- msysgit
-
git-for-windows - Git for Windows focuses on offering a lightweight, native set of tools that bring the full feature set of the Git SCM to Windows while providing appropriate user interfaces for experienced Git users and novices alike. Git for Windows provides a BASH emulation used to run Git from the command line. *NIX users should feel right at home, as the BASH emulation behaves just like the "git" command in LINUX and UNIX environments.
- official: https://github.com/git-for-windows/git/
- cygwin
- https://stackoverflow.com/questions/25019057/how-are-msys-msys2-and-msysgit-related-to-each-other
- https://stackoverflow.com/questions/40262434/what-are-the-differences-between-msys-git-and-git-for-windows-mingw-w64-x86-64-g
- https://github.com/msys2/msys2/wiki/How-does-MSYS2-differ-from-Cygwin
-
pushd
andpopd
- push in a stack current directory and then change it, pop from stack current directory - list: http://www.pixelbeat.org/cmdline.html
- Toybox - http://www.landley.net/toybox/
- Toybox combines many common Linux command line utilities together into a single BSD-licensed executable. It's simple, small, fast, and reasonably standards-compliant (POSIX-2008 and LSB 4.1).
- https://en.wikipedia.org/wiki/Toybox
- like toybox but GNU - https://en.wikipedia.org/wiki/BusyBox
- useful linux commands - https://searchdatacenter.techtarget.com/tutorial/77-Linux-commands-and-utilities-youll-actually-use
- http://mywiki.wooledge.org/BashPitfalls
- Read first
- Many programs use a so called HOME variable, like:
-
JAVA_HOME
for JDK (JRE is not good because you will not have access to the compiler: javac) -
M2_HOME
for Maven
-
- The format of a HOME variable:
MY_HOME=InstallDir
example- windows
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131
- linux
JAVA_HOME=/usr/local/jdk1.8.0_131
- windows
- To use binaries from those homes, add them to the special PATH variable. The binaries are usually in a
bin
directory- windows
set PATH=%JAVA_HOME%\bin;%PATH%
- linux/osx
export PATH=$JAVA_HOME/bin:$PATH
- windows
- Variables changes DO NOT propagate for running programs, so they should be restarted. This is by design.
- configure environment
- see Config Java Tools
- basic linux commands