The Shell

PTSource BASH Shell for Windows

Unlike other bash ports for Windows (e.g. the cygwin bash ), the PTSource Shell needs no special environment or DLLs.

PTSource Shell can be used as an input shell, as well as an interpreter to run *nix shell scripts.

List of avaliable commands besides BASH standard functions

basename cat chgrp chmod chown chroot cksum comm cp csplit cut date dd df dir dircolors dirname du echo egrep env expand expr factor false fgrep fmt fold gdate gecho ginstall gln gmkdir grep grmdir groups gsort head hostid hostname id install join kill link ln logname ls md5sum mkdir mkfifo mknod mv nice nl nohup od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir sed seq setuidgid sha1sum shred sleep sort split stat stty su sum sync tac tail tee test touch tr tree true tsort tty uname unexpand uniq unlink unzip uptime users vdir vim wc wget which who whoami xxd yes [

Using the Shell

A non-quoted backslash \ is the Bash escape character. It preserves the literal value of the next character that follows, with the exception of newline. If a \newline pair appears, and the backslash itself is not quoted, the \newline is treated as a line continuation (that is, it is removed from the input stream and effectively ignored). So moving in dirs in the Shell its slightly different so if you want to walk thru dirs you shoud use / instead of \ as in *nix.

Example

cd c:\   
# This is wrong and it will return c:
cd c:/   
# This is right and it will return c:\
cd c:\\
# This is also right and it will return c:\

Development Environment

The Shell as MinGW-w64 and Harbour already configured to build for Win32 and Win64.

Standard make commands :
  • make (standard *nix make)
  • mgmake (MinGW-w64 make)
  • ptsmake32 (PTSource Harbour make for Win32)
  • ptsmake64 (PTSource Harbour make for Win64)
BashRC and aliases

The Shell uses a simple ini file called PTShell.ini in the PTSource directory as is RC startup it fully supports aliases and it reads by default as fallows :

alias vi='nano'
alias vim='nano'
alias edit='nano'
alias h='history'
alias mc='gmc'
alias nc='gmc'
alias make='lmake' 
alias link='llink'
alias d='dir'
alias more='less'
alias ls='ls --color'
alias l='ls -l '
alias back='cd $OLDPWD'
alias texclean='rm -f *.toc *.aux *.log *.cp *.fn *.tp *.vr *.pg *.ky'
EDITOR='nano'
BASH='bash'
SHELL='bash'
CC='g++'
TERM=vt100
HOME=C:\\PTSOURCE\\PTEditor\\home
HISTFILE=C:\\PTSOURCE\\PTEditor\\home\\bash_history
PATH1=C:\\PTSOURCE\\PTEditor\\bin
# Builds for Win32
PATH2=C:\\PTSOURCE\\PTEditor\\builder\\comp\\mingw32\\bin
PATH3=C:\\PTSOURCE\\PTEditor\\builder\\comp\\harbour32\\bin
# Builds for Win64
#PATH2=C:\\PTSOURCE\\PTEditor\\builder\\comp\\mingw64\\bin
#PATH3=C:\\PTSOURCE\\PTEditor\\builder\\comp\\harbour64\\bin
PATH=$PATH1:$PATH2:$PATH3
MANPATH=C:\\PTSOURCE\\PTEditor\\man
SAMPLES=C:\\PTSOURCE\\PTEditor\\samples
export HOME PATH HISTSZIE HISTFILE MANPATH EDITOR SHELL TERM BASH SAMPLES CC

It can be edited to fit your needs.

Simple compilation commands examples from the Shell
  • gcc -c *.c && gcc *.o -o [binary file name]
  • make [clean|install]
  • mgmake [clean|install]
  • ptsmake32 [*.prg|*.hbc]
  • ptsmake64 [*.prg|*.hbc]