Frequently Asked Questions
-
What is a Unix shell?
-
Why would I need a Unix shell in Windows?
-
What is a Windows GUI-based graphical Unix shell?
-
What advantage does working in a GUI window give over a DOS console window?
-
What is the difference between the Unix versus Linux shell?
-
How do you support graphics in the shell without an X server?
-
How does the shell run in Windows without running Unix or Linux first?
-
How is the shell started?
-
How do I know what to do next after I am at the dollar sign prompt?
-
How do I get the ls command to display full Unix style numeric user and group id columns?
-
How do I get the fmt command to never join lines so that example source code in a can be correctly formatted?
-
How should I use #! in the shell?
-
What directories are needed for /dev/null to work properly?
-
How do I add a shortcut to the desktop that runs console and a command that uses TERMCAP?
-
Where is my shell profile stored?
-
How do I build a resource only DLL using Microsoft's command-line compiler?
-
How do I give a 3d look to a window?
-
How do I trace event handler code for each handler?
-
How do I free up memory allocated for a structure definition?
-
How do I suppress all output from the call command?
-
How do I just omit tty output?
-
What is the maximum array index in shell?
-
How do I assign shell variable from the @ construct?
-
How do I get the address of a shell variable?
-
How can I call printf() to a window?
-
Why might the system command not work properly?
-
Explain why no Unix fork compliance?
-
How do I show the option string for login shell?
-
Explain why sometimes it is not good to use relative pathnames?
-
Explain aliases to run other shells from the Janotech shell for Windows?
-
Explain why stdwin programs may not compile without any library function calls?
-
How do I use the find command in Windows so it ignores case for file searches?
-
When are HUP signal and TERM signal sent?
-
Why should I use fully qualified pathnames in C/C++ programs when using the Standard Windows Library?
-
How to force screen refresh in a program that uses curses in Windows?
-
How do I use iconify?
-
How do I use the TTS initialization functions?
-
How do I add multiple libraries using libs variable when using nmake script?
-
How do restore deleted files from the recycle bin using just the keyboard?
-
What new features does expr have?
-
What does an application using curses auto margin need to do to work correctly?
-
Why do WM_CHAR, WM_KEYDOWN and WM_KEYUP messages not work using rich edit controls?
-
How do I use SendMessage() to get and set return values from edit controls?
-
What is a Unix shell?
A Unix shell is a program that allows the user to type in commands at a command console prompt that can perform specific operating system tasks and also access the resources of the machine. A Unix shell for Windows is similar to the existing Windows DOS command line console but is much more powerful and programmable. top
-
Why would I need a Unix shell in Windows?
There are many reasons to use a Unix shell. You can control Windows with the same kind of feel as Unix or Linux systems. You can also program your computer or learn to program with the shell's very easy to use programming syntax. You can learn more about how Windows programs work and also write them directly using the shell's open programming environment. top
-
What is a Windows GUI-based graphical Unix shell?
A Windows GUI (Graphical User Interface) based shell is a program that runs in a standard Windows application window and provides a Unix-style command-line interface. The reason it is called graphical is that the user can enter commands at the shell prompt that can access Windows graphics as well. The user has complete control over the shell window from setting fonts to changing colors as well as capturing mouse and keyboard input and drawing graphics in the shell window. top
-
What advantage does working in a GUI window give over a DOS console window?
If the shell were running in a non-GUI or DOS-based console window, the user would be limited to the capabilities of the DOS console application which is limited as far as fonts, colors, window size, mouse access, and other properties. Also you cannot program a DOS console like a regular Windows application. Windows GUI function calls in do not apply to the DOS-style console window. top
-
What is the difference between the Unix versus Linux shell?
Even though Unix and Linux are similar operating systems, the shells that can be found on those systems are quite numerous. They are all based, however, on the Bourne shell standard and most have the same features. The other thing that differ between command shell environments has to do with the style of the commands themselves such as: ls, grep, more, etc. that you run from the shell prompt. The Janotech software package supports the BSD Unix flavor of the shell commands. top
-
How do you support graphics in the shell without an X server?
The Janotech Unix shell uses Windows graphics exclusively. It does not currently support X. Essentially the programming environment lets you access Windows DLL's and libraries from the shell itself using the shell's extended command constructs. top
-
How does the shell run in Windows without running Unix or Linux first?
Essentially, the shell runs like any other Windows application in Windows. It is designed to run as fast and as efficiently as possible from the Windows desktop. The only other program that runs first is a program called console.exe which is a Standard Windows application launcher that is used to run the shell program itself. No version of Linux or Unix or any kind of emulation layer is needed. top
-
How is the shell started?
You just click on the desktop icon for the Unix Shell for Windows. This will start the shell running in a window. The default shell prompt is a dollar sign ($). top
-
How do I know what to do next after I am at the dollar sign prompt?
You may then type in Unix (Linux) types of commands such as ls, ps, vi (for the editor). You can also get a manual on the commands by typing: man command where command is one of the standard commands. The best thing to do is to read the documentation manual from the beginning which is also located here: Docs. This will give you an introduction to some of the commands and what they do. top
-
How do I get the ls command to display full Unix style numeric user and group id columns?
Use ls -ln. In Windows the fields will be zero's. top
-
How do I get the fmt command to never join lines so that example source code in a can be correctly formatted?
Use fmt -z (new option added to fmt command). top
-
How should I use #! in the shell?
In the shell be careful when using #!/bin/ksh at beginning of scripts. If you have for instance a command like cat residing in the c:/bin directory and the cat in your script does not specify a full pathname, then the cat in c:/bin will run instead based on where the #! says the interpreter resides. top
-
What directories are needed for /dev/null to work properly?
When using /dev/null you to have $TMP or $TEMP directories defined. top
-
How do I add a shortcut to the desktop that runs console and a command that uses TERMCAP?
When adding a shortcut to desktop that runs console and a command that uses TERMCAP, make sure TERM and EDITOR are set for target. For example, c:\mybin\console.exe -set TERM=pc -set EDITOR=c:\mybin\vi "c:/mybin/less things_to_do" top
-
Where is my shell profile stored?
The profile is $JANOTECH/$USERNAME/profile.ksh (only executes if login shell). Use $JANOTECH/$USERNAME/kshrc.ksh for any shell level stuff, for aliases for instance. top
-
How do I build a resource only DLL using Microsoft's command-line compiler?
Use link -noentry -dll filename.res -out:filename.dll top
-
How do I give a 3d look to a window?
Use the $WS_EX_CLIENTEDGE style in CreateWindowEx(). top
-
How do I trace event handler code for each handler?
Use set -o xtrace to trace event handler code (needed in each handler). top
-
How do I free up memory allocated for a structure definition?
Use the destruct builtin to free a structure from memory. top
-
How do I suppress all output from the call command?
Use call -s or -q (suppress output no matter what). top
-
How do I just omit tty output?
Use call -o or -z (omit output if a tty). For example: alias call='call -o' to not send any output to a shell window. top
-
What is the maximum array index in shell?
Currently there is no maximum array index (not bounded by ARRAYMAX). top
-
How do I assign shell variable from the @ construct?
The construct @ can assign to shell variable using @ shell-var=$struct-addr.member top
-
How do I get the address of a shell variable?
@ -a option returns address of structure reference like C language "&" (at-sign). top
-
How can I call printf() to a window?
Use call printf which calls the builtin printf() stdwin call so as to be able to display pointer addresses using "%s" format string if needed. top
-
Why might the system command not work properly?
In order for the system() command to work properly a copy of the shell must exist in the bin directory of the C drive as c:/janotech/bin/sh.exe - this ensures POSIX compatability. top
-
Explain why no Unix fork compliance?
Unix fork compliance: the shell does not create new process for child if possible to make the shell command substitutions run faster $(...) but loses compliance with initializing such things as local variables. The solution is to use typeset before the variable name as in: $(typeset var=value; ...) top
-
How do I show the option string for login shell?
echo $- shows initial option string. If an 'l' is present you are at the login or initial level of the shell. top
-
Explain why sometimes it is not good to use relative pathnames?
Using relative pathnames when running the shell using console it is not good to use console ./sh. Once a cd is done to a different directory, sh will use ./sh to run scripts, etc. and if a copy of sh.exe is not in the current directory commands will fail. The correct format would be to use the full sh pathname as in: console /bin/sh. top
-
Explain aliases to run other shells from the Janotech shell for Windows?
Use for example alias cmd='winexec command.com' or alias bash='winexec bash.exe' top
-
Explain why stdwin programs may not compile without any library function calls?
For Microsoft C/C++ Compiler you need at least one library function call such as printf() in the program or the compiler may complain about multiple symbols being defined (LIBC.LIB) otherwise you need to add the linker flag /FORCE:MULTIPLE. top
-
How do I use the find command in Windows so it ignores case for file searches?
Use find -iname to ignore case for Windows file searches. top
-
When are HUP signal and TERM signal sent?
The HUP signal is sent when a shell exits while the TERM signal is sent when issuing a kill command on a job. top
-
Why should I use fully qualified pathnames in C/C++ programs when using the Standard Windows Library?
Since functions like spawn and exec eventually call CreateProcess(), fully qualified pathnames should be used in both C/C++ programs and shell scripts since Windows executable search sequence starts by searching the directory the application loaded from and the Windows system directories before searching the directories contained in the PATH variable unlike on UNIX or Linux where path in the exec functions must be the correct path--this difference in searching can also be controlled in shell scripts by using aliases. top
-
How to force screen refresh in a program that uses curses in Windows?
Calling SetEvent(GetKeyboard()->eventHandle) when there is no key pressed will return GetKeyboard()->intrChar (interrupt char) in any pending call to getch() - this is useful when the application normally refreshes the screen on getting an interrupt char - both vi and less work this way - if GetKeyboard()->intrChar was set to a char that the application did not do a screen refresh on then this shortcut would not work - this shortcut code cuts down on having to find the exact code necessary to refresh the screen. Example code:
void winch()
{
// call function to redraw screen
my_screen_redraw();
signal(SIGWINCH, winch);
// force refresh of screen but we do not need to know what curses routines to call
SetEvent(GetKeyboard()->eventHandle);
}
top
-
How do I use iconify?
Use iconify to allow stdin, stdout and stderr not to be closed before and re-opened after running a non-GUI Windows console or DOS app - if there is a need to pipe to stdin or from stdout or stderr iconify should preface the program and the output piped back to the shell - the shell keeps stdin, stdout and stderr open since iconify is a Windows GUI app and not a Windows console app - iconify then launches the console non-GUI Windows app - example usage: iconify c:/windows/ping 127.0.0.1 | cat - the output of the ping command will be redirected to the main console window - to make the command easier to use aliases can be setup such as: alias ping='/bin/ping' where the script in /bin contains: iconify c:/windows/ping $* | cat - also may want to add 2>&1 before pipe to cat if the command sends error or help messages to stderr as in: iconify program $* 2>&1 | cat - this redirects stderr to stdout. top
-
How do I use the TTS initialization functions?
When using InitTTS() and FreeTTS(), InitTTS() must be the very first Text-To-Speech function called and FreeTTS() must be the very last one called - calling FreeTTS() before any other TTS functions may cause the program to hang since some pointers may have been freed in the call to FreeTTS() - likewise InitTTS() must be the first called in order to initialize the Text-To-Speech library. top
-
How do I add multiple libraries using libs variable when using nmake script?
Use: nmake app=createlink winmain=winmain 'libs=\"shell32.lib uuid.lib ole32.lib\"' top
-
How do restore deleted files from the recycle bin using just the keyboard?
Restore deleted file(s) from recycle bin key sequence - after deleting file(s) to recycle bin press: CTRL+ESC, ESC, SHIFT+TAB, CTRL+Z - if natural keyboard - WINDOWS+M, CTRL+Z, SHIFT+WINDOWS+M top
-
What new features does expr have?
New version has floating point math builtin and uses { } and [ ] for grouping - also do: set -o noglob to use "*" instead of "\*". You can also use x for multiplication. top
-
What does an application using curses auto margin need to do to work correctly?
If an application uses curses :am: (auto margin) feature you need to set console style flag WRAP_LINES and also save maxlen and restore on exit. top
-
Why do WM_CHAR, WM_KEYDOWN and WM_KEYUP messages not work using rich edit controls?
When copying, pasting, and selecting text in a rich edit control WM_CHAR, WM_KEYDOWN, and WM_KEYUP messages do not work. Instead use WM_COPY, WM_PASTE, and EM_SETSEL top
-
How do I use SendMessage() to get and set return values from edit controls?
Example: z=$(malloc $max_line_size); line_size=$(call SendMessage $hwnd_edit $EM_GETLINE 0 $z). This should return number of chars copied and store edit text at $z. top
© Janotech, LLC 2008