GithubHelp home page GithubHelp logo

adacore / gsh Goto Github PK

View Code? Open in Web Editor NEW
99.0 10.0 10.0 14.1 MB

A POSIX shell for Windows.

Makefile 0.07% Shell 1.98% Python 2.24% Perl 0.05% Awk 0.49% C 60.88% C++ 1.22% XSLT 1.64% Ada 25.10% M4 6.34%

gsh's Introduction

GSH - A POSIX shell for Windows

General Information

GSH is an implementation of a POSIX shell developed for the Windows platform.

The aim of the project is to provide an efficient UNIX shell instantiation for Windows, for non interactive usage.

GSH can be used to compile projects depending on autotools, UNIX make,... As it targets specifically Windows platform, GSH differs significantly from the most used ones such as bash, zsh. Among others, its implementation does not depend on the 'fork system call' and doesn't emulate that system call (as it's done on Cygwin). This allows better compiling performance (the build times can be up to 3 or 4 times faster than builds performed by projects such as Cygwin).

XKCD on shell escaping

Image from XKCD

Build & Installation

Run:

$ make
$ make install PREFIX=<target directory>

Alternatively to just compile the gsh binary you can do:

$ gprbuild -p -P posix_shell

Example of Usage

Currently the main goal of the project is to speed up builds of GNU projects on Windows platform. As the project is still not complete you still need a Cygwin installation for the tools not provided by GSH. The only requirement is that the build should be done in a path for which Cygwin path maps directly to a Windows path. For example if you do your build in c:/MyBuilds then in Cygwin the path should map to /MyBuilds.

An example of build sequence that does not destroy your current Cygwin environment:

$ (export PATH=$GSH_INSTALL_DIR/bin:$PATH;
   export SHELL=$GSH_INSTALL_DIR/bin/gsh; 
   export CONFIG_SHELL=$GSH_INSTALL_DIR/bin/gsh;
   $CONFIG_SHELL/configure --prefix=/myinstall_dir
   make)

License

All files are provided under terms of the GNU General Public License version 3.

The project includes fragments of other projects with licenses compatible with the GNU General Public License version 3:

gsh's People

Contributors

avindra avatar brobecke avatar enzbang avatar nikokrock avatar vreboul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gsh's Issues

Implement test -t

There is now support to detect if a given file descriptor is a terminal or not in the OS lib

read fails with IFS set

While setting IFS works fine for for loops it fails with read, none of the variables get set if IFS is set

#!gsh
string="word1 word2 word3"
string2="word1-word2-word3"
echo "READ IFS not set (works)"
read field1 field2<<EOF
$string
EOF
echo "Field1: $field1 Field2: $field2"
unset field1 field2 IFS
echo "READ IFS set to space (fails)"
IFS=" " read field1 field2<<EOF
$string
EOF
echo "Field1: $field1 Field2: $field2"
unset field1 field2 IFS
echo "READ IFS set to w (fails)"
IFS="w" read field1 field2<<EOF
$string
EOF
echo "Field1: $field1 Field2: $field2"

echo "FOR LOOP IFS NOT SET"
for i in $string; do
  echo "'$i' is the substring"
done

echo "FOR LOOP IFS SET (WORKS)"
IFS="-"
for i in $string2; do
  echo "'$i' is the substring"
done

Output gsh:

READ IFS not set (works)
Field1: word1 Field2: word2 word3
READ IFS set to space (fails)
Field1:  Field2:
READ IFS set to w (fails)
Field1:  Field2:
FOR LOOP IFS NOT SET
'word1' is the substring
'word2' is the substring
'word3' is the substring
FOR LOOP IFS SET (WORKS)
'word1' is the substring
'word2' is the substring
'word3' is the substring

Output yash -o posixlycorrect:

READ IFS not set (works)
Field1: word1 Field2: word2 word3
READ IFS set to space (fails)
Field1: word1 Field2: word2 word3
READ IFS set to w (fails)
Field1:  Field2: ord1 word2 word3
FOR LOOP IFS NOT SET
'word1' is the substring
'word2' is the substring
'word3' is the substring
FOR LOOP IFS SET (WORKS)
'word1' is the substring
'word2' is the substring
'word3' is the substring

Build failed.

Tried to build this shell accordingly to README description (on windows 10)

Alternatively to just compile the gsh binary you can do:

$ gprbuild -p -P posix_shell

Here is shell output (blessed be emacs):

c:\repos>git clone https://github.com/AdaCore/gsh.git
git clone https://github.com/AdaCore/gsh.git
Cloning into 'gsh'...
Checking out files: 100% (1248/1248), done.

c:\repos>cd gsh
cd gsh

c:\repos\gsh>gprbuild.exe -p -P posix_shell
gprbuild.exe -p -P posix_shell
object directory "C:\repos\gsh\obj\dev" created
object directory "C:\repos\gsh\lua\obj" created for project lua
library directory "C:\repos\gsh\lua\lib" created for project lua
object directory "C:\repos\gsh\os\obj\dev" created for project os
library directory "C:\repos\gsh\os\lib" created for project os
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos strmatch.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos gsh_lexer.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos gsh.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos builtin.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos gsh_unit.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos gsh_dump_tree.adb
gcc -c -g -O0 windows.c
gcc -c -g -O0 windows-kernel.c
gcc -c -g -O0 unix.c
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos os.ads
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos os-fs.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos os-fs-stat.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos os-fs-dir.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos os-exec.adb
gcc -c -Wall -O2 -DLUA_COMPAT_ALL lzio.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL lvm.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL lundump.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL luac.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL lua.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL ltm.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL ltablib.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL ltable.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL lstrlib.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL lstring.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL lstate.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL lparser.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL loslib.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL lopcodes.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL lobject.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL loadlib.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL lmem.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL lmathlib.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL llex.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL liolib.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL linit.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL lgc.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL lfunc.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL ldump.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL ldo.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL ldebug.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL ldblib.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL lctype.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL lcorolib.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL lcode.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL lbitlib.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL lbaselib.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL lauxlib.c
gcc -c -Wall -O2 -DLUA_COMPAT_ALL lapi.c
gcc -c -DHAVE_CONFIG_H -g -O0 xmalloc.c
gcc -c -DHAVE_CONFIG_H -g -O0 xfree.c
gcc -c -DHAVE_CONFIG_H -g -O0 vi_mode.c
gcc -c -DHAVE_CONFIG_H -g -O0 util.c
gcc -c -DHAVE_CONFIG_H -g -O0 undo.c
gcc -c -DHAVE_CONFIG_H -g -O0 tilde.c
gcc -c -DHAVE_CONFIG_H -g -O0 text.c
gcc -c -DHAVE_CONFIG_H -g -O0 terminal.c
gcc -c -DHAVE_CONFIG_H -g -O0 signals.c
gcc -c -DHAVE_CONFIG_H -g -O0 shell.c
gcc -c -DHAVE_CONFIG_H -g -O0 search.c
gcc -c -DHAVE_CONFIG_H -g -O0 savestring.c
gcc -c -DHAVE_CONFIG_H -g -O0 rltty.c
gcc -c -DHAVE_CONFIG_H -g -O0 readline.c
gcc -c -DHAVE_CONFIG_H -g -O0 parens.c
gcc -c -DHAVE_CONFIG_H -g -O0 nls.c
gcc -c -DHAVE_CONFIG_H -g -O0 misc.c
gcc -c -DHAVE_CONFIG_H -g -O0 mbutil.c
gcc -c -DHAVE_CONFIG_H -g -O0 macro.c
gcc -c -DHAVE_CONFIG_H -g -O0 kill.c
gcc -c -DHAVE_CONFIG_H -g -O0 keymaps.c
gcc -c -DHAVE_CONFIG_H -g -O0 isearch.c
gcc -c -DHAVE_CONFIG_H -g -O0 input.c
gcc -c -DHAVE_CONFIG_H -g -O0 histsearch.c
gcc -c -DHAVE_CONFIG_H -g -O0 history.c
gcc -c -DHAVE_CONFIG_H -g -O0 histfile.c
gcc -c -DHAVE_CONFIG_H -g -O0 histexpand.c
gcc -c -DHAVE_CONFIG_H -g -O0 funmap.c
gcc -c -DHAVE_CONFIG_H -g -O0 display.c
gcc -c -DHAVE_CONFIG_H -g -O0 complete.c
gcc -c -DHAVE_CONFIG_H -g -O0 compat.c
gcc -c -DHAVE_CONFIG_H -g -O0 callback.c
gcc -c -DHAVE_CONFIG_H -g -O0 bind.c
gcc -c -DHAVE_CONFIG_H -g -O0 windows-termcap.c
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos sh.ads
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos sh-re.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos sh-tokens.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos sh-tokens-lexer.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos sh-traces.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos sh-builtins.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos sh-opts.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos sh-parser.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos sh-states.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos sh-states-io.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos sh-tree.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos sh-tree-dumps.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos sh-tree-evals.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos sh-utils.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos lua.adb
gcc -c -g -gnata -gnatwe -g -O0 -gnat12 -gnatwcfijklmopruvz -gnaty -fpreserve-control-flow -fdump-scos sh-lua_bindings.ads
cannot generate code for file sh-lua_bindings.ads (package spec)
gprbuild: *** compilation phase failed

Seems like at least one package is missing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.