||Home||Switchboard||Unix Administration||Red Hat||TCP/IP Networks||Neoliberalism||Toxic Managers|
|(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and bastardization of classic Unix|
|Unix shells||Recommended Links||KSH Substitutions||Command history reuse||Filesystem navigation|
|Shell Prompts||Dotfiles||Shell debugging||Functions in Shell||Vi mode||Pushd, popd and dirs||I/O Redirection|
|Sequences of commands||Strange Files Deletion|
|Shell Aliases||Arithmetic expressions||Shell scripts collections||Pipes in Loops||Unix Shell Tips and Tricks||Humor||Etc|
The best implementation of ksh93 is Tksh that allows to use TCL on top of ksh93:
Tksh is an implementation of the Tcl C library written on top of the library for the new KornShell (ksh93). Tksh emulates the behavior of Tcl by using the API that is provided for extending ksh93, which is similar to the Tcl library in that it allows access to variables, functions and other state of the interpreter. This implementation allows Tcl libraries such as Tk to run on top of ksh93 unchanged, making it possible to use shell scripts in place of Tcl scripts. ksh93 is well suited for use with Tk because it is backward compatible with sh, making it both easy to learn and easy to extend existing scripts to provide a graphical user interface. Tksh is not yet another port of Tk to another language -- it allows Tcl scripts to run without modification using the ksh93 internals.
As stated on the AT&T software download selections page (it has binaries for most flavors of Unix in existence):
KSH-93 provides the following features, many of which were also inherent in KSH-88:
- Enhanced Command Re-entry Capability: The KSH-93 history function records commands entered at any shell level and stores them, up to a user-specified limit, even after you log off. This allows you to re-enter long commands with a few keystrokes - even those commands you entered yesterday. The history file allows for eight bit characters in commands and supports essentially unlimited size histories.
- In-line Editing: In "sh", the only way to fix mistyped commands is to backspace or retype the line. KSH-93 allows you to edit a command line using a choice of EMACS-TC or "vi" functions. You can use the in-line editors to complete filenames as you type them. You may also use this editing feature when entering command lines from your history file. A user can capture keystrokes and rebind keys to customize the editing interface.
- Extended I/O Capabilities: KSH-93 provides several I/O capabilities not available in "sh", including the ability to:
- specify a file descriptor for input and output
- start up and run co-processes
- produce a prompt at the terminal before a read
- easily format and interpret responses to a menu
- echo lines exactly as output without escape processing
- format output using printf formats.
- read and echo lines ending in "
- Improved performance: KSH-93 executes many scripts faster than the System V Bourne shell. A major reason for this is that many of the standard utilities are built-in. To reduce the time to initiate a command, KSH-93 allows commands to be added as built-ins at run time on systems that support dynamic loading such as System V Release 4.
- Arithmetic: KSH-93 allows you to do integer arithmetic in any base from two to sixty-four. You can also do double precision floating point arithmetic. Almost the complete set of C language operators are available with the same syntax and precedence. Arithmetic expressions can be used to as an argument expansion or as a separate command. In addition there is an arithmetic for command that works like the for statement in C.
- Arrays: KSH-93 supports both indexed and associative arrays. The subscript for an indexed array is an arithmetic expression, whereas, the subscript for an associative array is a string.
- Shell Functions and Aliases: Two mechanisms - functions and aliases - can be used to assign a user-selected identifier to an existing command or shell script. Functions allow local variables and provide scoping for exception handling. Functions can be searched for and loaded on first reference the way scripts are.
- Substring Capabilities: KSH-93 allows you to create a substring of any given string either by specifying the starting offset and length, or by stripping off leading or trailing substrings during parameter substitution. You can also specify attributes, such as upper and lower case, field width, and justification to shell variables.
- More pattern matching capabilities: KSH-93 allows you to specify extended regular expressions for file and string matches.
- KSH-93 uses a hierarchal name space for variables. Compound variables can be defined and variables can be passed by reference. In addition, each variable can have one or more disciplines associated with it to intercept assignments and references.
- Improved debugging: KSH-93 can generate line numbers on execution traces. Also, I/O redirections are now traced. There is a DEBUG trap that gets evaluated after each command so that errors can be localized.
- Job Control: On systems that support job control, including System V Release 4, KSH-93 provides a job-control mechanism almost identical to that of the BSD "csh", version 4.1. This feature allows you to stop and restart programs, and to move programs between the foreground and the background.
- Added security: KSH-93 can execute scripts which do not have read permission and scripts which have the setuid and/or setgid set when invoked by name, rather than as an argument to the shell. It is possible to log or control the execution of setuid and/or setgid scripts. The noclobber option prevents you from accidentally erasing a file by redirecting to an existing file.
- KSH-93 can be extended by adding built-in commands at run time. In addition, KSH-93 can be used as a library that can be embedded into an application to allow scripting.
Documentation for KSH-93 consists of an "Introduction to KSH-93", "Compatibility with the Bourne Shell" and a manual page and a README file. In addition, the "New KornShell Command and Programming Language," book is available from Prentice Hall.
David Korn is one of the very few "recordsmen" in maintaining his software product. He actually maintained it since 1983, than means for more then 20 years ! The current version (as of Jan, 2005) of ksh93 is ksh93q released Dec 1, 2004.
Anyway Korn shell is a more powerful instrument than either C-shell or bash. Two major versions exist ksh88 and ksh93. The latest (Ksh93) version is more powerful than bash 2.0/3.0 and is the best commercial shell available. Ksh93 is now free for educational and private use. The only shell that can complete with ksh93 featurewise is probably zsh. the unique feature of ksh93 is that it has a really high-quality Windows implementation, see U/Win project homepage . UWIN provides the following functionality for WIN32 applications:
- Process control and management:
- While processes can be created using the
fork(2)function, UWIN includes a spawn family of functions that combines the functionality of fork/exec for efficiency. With the exec family of functions, an existing process can be overlaid with another process. Each process has a unique process id and each process belongs to a process group. The vfork(2)function is also an efficient way to create processes.
- File descriptor semantics:
- Open files, pipes, sockets, fifos, and character and block special devices files have file descriptors associated with them. They can be duped and inherited with UNIX semantics.
- UNIX signal semantics:
- Nearly all of the UNIX signals are provided, including job control signals so that
ksh(1)can stop and restart jobs. A process can catch, block or ignore signals. Signals can be sent to processes or to process groups. Applications compiled with the -D_BSDCOMPAT flag obey UCB UNIX signal semantics.
- Support for devices:
- UWIN provides character and block devices with major and minor numbers as found on UNIX systems. Support for direct access to floppy drives (/dev/fd0), and SCSI tape drives (/dev/mt0), as well as ptys and ttys is available.
- Terminal interface for consoles, sockets, and serial lines:
- The POSIX termios interface is supported for consoles with vt100 emulation. Serial lines, and sockets that have been designated as virtual terminals. UWIN supports pseudo-ttys.
- Use of the mouse with console windows:
- The left mouse button in a console window can be used to select text and copy to the clipboard. The right button (or middle button on a three button mouse) can be used to paste text from the clipboard. The /dev/clipboard pseudo-device can be used to redirect command input and output to the clipboard. The /dev/windows pseudo-device can be used within
select(2)to block until mouse or keyboard events are received.
- UCB sockets based on WINSOCK:
- The socket interface uses the UCB header files and naming conventions, but is implemented as calls to WINSOCK. Sockets are file descriptors and obey file descriptor semantics. Both internet domain protocol (i.e. AF_INET family) and UNIX domain sockets (AF_UNIX family) are provided. The multicast socket protocol is supported. The connect stream library, which provides a higher level and easier to user interface, is also provided.
- Pathname mapping from UNIX to Windows:
- UWIN provides UNIX style naming for all files with / as the filename delimiter by creating mounts. The / directory location can be selected at installation. Each drive letter in Windows is mounted in a single letter directory name under / so that /a/file is the UWIN name for a:\file. In addition, certain directories are implicitly mounted such as /sys on the system directory, /win on the windows directory, and /msdev on the directory containing the Microsoft development kit if installed. The character and block special devices are in /dev and use naming conventions found on most UNIX systems. UWIN also supports UNC (universal naming convention) names for files that begin with //. An API function is provided to map the UNIX name into the Windows name. The mapping is available from ksh as well.
- UNIX naming conventions:
- The PATH variable is a : separated list of directories rather than a ; separated list. The cc command generates files with a .o suffix by default. However, some characters such as \, *, ?, |, &, <. >, and : are not valid as part of file names. By default, directories are mounted without case distinction. However, the mount command allows directories to be mounted as case sensitive so that the files makefile and Makefile are distinct. In addition, there is a registry key that can be set to make the default case sensitive.
- Mapping to and from UNIX ids/permissions to NT/2000/XP permissions:
- Windows NT/2000/XP subject identifiers are mapped to UNIX user ids and group ids. UNIX permissions are mapped onto Windows NT/2000/XP file ACLs. The Administrator can use chown() to change the owner and or group of a file.
- File control locking:
- UNIX file control advisory locking is supported by UWIN with deadlock detection.
- Memory mapping and shared memory:
- Both mmap() and the system V shared memory facilities are provided.
- System V IPC:
- The System V semaphore and message calls are implemented.
- Runtime linking of dynamically linked libraries:
- The dlopen(), dlsym() interface from System V Release 4 is provided.
- Error mapping from Windows to UNIX:
- Errors returned by WIN32 functions are mapped into UNIX errnos.
- i-node numbers:
- An i-node number is returned when reading a file and when stating a file.
- Hard links:
- Hard links are supported on both NTFS and FAT file systems.
- Symbolic links:
- Symbolic links to files and directories can be created in UWIN and are implemented as Windows shortcuts. A .lnk suffix will be appended to these file names but will not appear when reading directories with UWIN. Shortcuts created by Windows appear as symbolic links in UWIN but do not have the .lnk suffix removed.
- Fifo's (UNIX named pipes) can be created with mkfifo() and opened as an ordinary file.
- Setuid and setgid programs:
- Users can authorize setuid and/or setgid programs to be run on their behalf and use chmod() to turn on setuid permission for a program. The program must be on an NTFS file system.
- inet Daemons and commands:
- UWIN 3.2 comes with the UCB inet daemon, the telnet daemon, the rlogin daemon, and the rsh daemon. It also includes the telnet, ftp, rsh, and rlogin programs. The ssh daemon and program can be built from the source but is not included because of possible export restrictions.
- Access of Registry through the File System:
- UWIN treats the Windows registry as a file system with registry keys treated as files, and keys that have sub-keys treated as directories. You can use UWIN tools directly on registry keys. The registry is automatically mounted under /reg during startup.
- ssh and ssh daemon:
- A compilation of openssh-3.6p1. Cron daemon: UWIN comes with a cron daemon that is used for running at and cron jobs. The cron daemon is started by /etc/rc on Windows NT/2000/XP.
- AT&T open source utilities:
- Most of the UWIN utilities are based on the AT&T open source utilities that are portable across virtually all systems and are based on the POSIX and X/Open standards. The utilities generate their own manual pages.
- Development tools:
- UWIN comes with cc and ncc compiler wrappers that use the Visual C/C++ compiler to build UWIN or native applications respectively. Development tools such as yacc, lex, ar, nm and rcs are also provided. UWIN provides both the traditional make and the much more powerful AT&T nmake building tool.
- Support for multibyte locales:
- Most of the utilities and libraries support localization to different locales including multibyte locales. The iconv utility can be used to convert from one character set to another. X11 server and utilities: A compilation of X11R6.5 is available as add on packages.
For shell programming ksh93 is still the best shell around. In the absence of a better one, as long as you apply the right magic to your .kshrc you can get around some limitations. To get some decent command line editing do a 'set -o emacs', to get the arrow keys etc to work
alias __A=`/bin/echo "\020"` # Up alias __B=`/bin/echo "\016"# Down alias __C=`/bin/echo "\006"` # Right alias __D=`/bin/echo "\002"` # Left alias __H=`/bin/echo "\001"` # Home alias __p=`/bin/echo "\004"` # Delete alias __q=`/bin/echo "\005"` # End alias __z=`/bin/echo "\017"` # Clea
(The previous works on Solaris, it might need some tweaking for different forms of echo) Unfortunately, I don't know of an easy way to get TAB to do filename completion (the default is ESC ESC in ksh93).
Google matched content
Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers : Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism : The Iron Law of Oligarchy : Libertarian Philosophy
War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda : SE quotes : Language Design and Programming Quotes : Random IT-related quotes : Somerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose Bierce : Bernard Shaw : Mark Twain Quotes
Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 : Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law
Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds : Larry Wall : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOS : Programming Languages History : PL/1 : Simula 67 : C : History of GCC development : Scripting Languages : Perl history : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history
The Peter Principle : Parkinson Law : 1984 : The Mythical Man-Month : How to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Haterís Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite
Most popular humor pages:
Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor
The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D
Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.
This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...
|You can use PayPal to to buy a cup of coffee for authors of this site|
Last modified: March 12, 2019