"xyzsh" shell script language
What is this software?
a shell script language under linux, OSX, cygwin, and FreeBSD.
> ls -F
docs/ main.c samples/ sub.c
> ls | each ( | chomp | -d && | print )
> ls -F | grep -v /
> ls | each ( ! | chomp | -d && | print )
> ls | each ( | printf "-+- %s -+-"\n ) | join " "
-+- docs -+- -+- main -+- -+- samples -+- -+- sub.c -+-
> ls | each ( | scan . | join " " )
d o c s
m a i n . c
s a m p l e s
s u b . c
> cat data
> cat data | each ( | =~ Yamanaka && | print )
> cat data | lines 0 1
> cat data | each ( | split | lines 1 0 | join )
> vim student.xyzsh
class Student (
| var first_name second_name age country
def show (
var first_name second_name age country | printf "name: %s %s?nage: %s?ncountry: %s?n"
student::run ( print "Yamanaka Gorou 23 Japan" | split | Student )
> load student.xyzsh
name: Yamanaka Gorou
Compiled and tested xyzsh below Operating systems
Oracle Solaris 11 Express
I am a Japanese and an English learner. I'm so sorry for my strange English and please allow me to write such a English. I'll correct this step by step with my understanding English.
Use this software on your own risk. Don't use this under importnat systems. I recommend that you use this on your personal systems. I can't take a responsibility on your works with xyzsh. And use this with understanding that this language is not high performance.
How to compile
Before compiling xyzsh, you need to resolve dependencies below. You need development packages.(ex. ncurses-devel or libncurse-dev)
oniguruma (which is a regex library)
Have you installed above libraries? You can type below commands to compile xyzsh.
sudo make install
Default prefix is /use/local/bin, so you need a root comission for make install.
If you want to change an installed directory, type below
./configure --prefix=??? --with-optimize
sudo make install
sudo make DESTDIR=??? install
When you choise normal install, installed xyzsh to /usr/local/bin and setting files to /usr/local/etc/xyzsh.
configure options are below.
--prefix --> indicate installed directory. If you use --prefix=$HOME, xyzsh will be installed $HOME/bin, $HOME/etc. As default, prefix is /usr/local.
--with-optimize --> compiled with optimize. Fast binary will be made.
--with-onig-dir --> indicate oniguruma installed directory.
--with-readline-dir --> indicate readline installed directory.
--with-debug --> give -g option to CFLAGS and add a checking memory leak system to xyzsh.
--with-gprof-debug --> give -pg option to CFLAGS
--with-static --> make xyzsh without dynamic linked libraries.
For Japanese options
--with-migemo --> enable migemo_match inner command for Japanse
--with-migemo-dir --> indicate migemo installed directory.
--with-system-migemodir --> specify the directory of system migemo dictionary.
xyzsh makes library, so add /usr/local/lib(or your installed directory) to /etc/ld.so.conf and type below to refresh dynamic loarding searched path cache.
If you don't have root comission, add the path to LD_LIBRARY_PATH environment variable. (With OSX, you should use DYLD_LIBRARY_PATH_FALLBACK environment variable.)
with OS X
Before you installed xyzsh, you should compile the readline library because OSX's readline is libedit, xyzsh needs GNU readline.
Also you can use Macports or other compling system instead of manually compiling to install GNU readline.
/usr/local/bin/xyzsh --> a program
/usr/local/share/doc/xyzsh/USAGE --> USAGE in English
/usr/local/share/doc/xyzsh/USAGE.ja --> USAGE in Japanese
/usr/local/share/doc/xyzsh/README --> README in English
/usr/local/share/doc/xyzsh/README.ja --> README in Japanese
/usr/local/share/doc/xyzsh/CHANGELOG --> CHANGELOG in English and Japanese
/usr/local/share/man/man1/xyzsh.1 --> manual file
/usr/local/etc/xyzsh/xyzsh.xyzsh --> a source setting file
/usr/local/etc/xyzsh/completion.xyzsh --> a source completion setting file
/usr/local/etc/xyzsh/help.xyzsh --> a source help setting file
/usr/local/etc/xyzsh/read_history.xyzsh --> a source which reads command line history
/usr/local/lib/xyzsh/*.so --> xyzsh C extension library
~/.xyzsh/xyzsh.xyzsh --> a source user setting file. xyzsh read this after /usr/local/etc/xyzsh.xyzsh
~/.xyzsh/history --> a command line history file
~/.xyzsh/macro --> macro which is runned by typing C-x on command line uses this file
~/.xyzsh/jump --> jump inner command uses this file
~/.xyzsh/menu --> menu inner command uses this file
~/.xyzsh/program --> program list which is entried to root object
~/.xyzsh/lib/*.so --> xyzsh C extension library for user
Encoding and Line field
xyzsh script source file must be written with UTF-8 encode and LF Linefield. But, xyzsh can treat UTF8, EUCJP, and SJIS encodings and can treat LF, CR, LFCR line fields. (EUCJP and SJIS are for Japanese)
You should run xyzsh as interactive shell on UTF-8 terminal.
to use as interactive shell
> ./xyzsh -c "command"
to run the command
> ./xyzsh (script file name)
to run the script file
CHANGELOG --> a changing log
LINCENSE --> MIT License described file
Makefile.in --> Source of Makefile
README --> This file
USAGE --> Usage
config.h.in --> source of config.h
configure --> configure program
configure.in --> source of configure
install.sh --> used by configure
src/xyzsh/xyzsh.h --> xyzsh header file
xyzsh.xyzsh --> xyzsh run time script
completion.xyzsh --> xyzsh completion run time script
src/xyzsh --> headers
src/block.c --> code structure
src/cmd_ary.c --> inner commands which is related to array
src/cmd_base.c --> base inner commands
src/cmd_condition.c --> condition expression inner commands
src/cmd_curses.c --> inner commands which manipulate text consoles.
src/cmd_file.c --> inner commands which is related to file system.
src/cmd_num.c --> math inner commands.
src/cmd_obj.c --> object oriented system inner commands
src/cmd_str.c --> inner commands which manipulate strings.
src/curses.c --> manipulating text console.
src/debug.c --> my debug system. for expample, detecting memory leak
src/gc.c --> xyzsh object gabage collector
src/hash.c --> hash container library
src/interface.c --> related to interface code
src/kanji.c --> treated utf-8 (or Japanese SJIS, EUCJP) code
src/list.c --> list container library
src/main.c --> main code
src/object.c --> etc objects
src/parser.c --> parser
src/xyzsh.c --> xyzsh
src/readline.c --> readline code for interactive shell
src/run.c --> main engine for xyzsh
src/stack.c --> xyzsh stack object manager
src/string.c --> string library
src/vector.c --> dynamic array library
src/nfun.c --> native function object
src/fd.c --> file discriptor object
src/extprog.c --> external program object