LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-02-2008, 10:51 PM   #1
msivasakthi
LQ Newbie
 
Registered: Mar 2007
Location: India
Distribution: FC5
Posts: 17

Rep: Reputation: 0
Diffrence between Korn and bash shell in Linux


Hi all,

What is the difference between korn and bash shell?
direct me if you have any specific document..

Thanks,
 
Old 07-02-2008, 11:30 PM   #2
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
http://www.faqs.org/faqs/unix-faq/shell/bash/

See questions:

C1) How does bash differ from sh, the Bourne shell?
C2) How does bash differ from the Korn shell, version ksh88?
C3) Which new features in ksh-93 are not in bash, and which are?

[Edit: Link updated]

Last edited by Mr. C.; 04-12-2011 at 10:04 AM.
 
Old 04-12-2011, 01:59 AM   #3
me.raviraj007
LQ Newbie
 
Registered: Apr 2011
Posts: 9

Rep: Reputation: 0
Post

Hello i am not able to open the document
can you mail me or give some download link
if mail do on me.raviraj007@gmail.com
 
Old 04-12-2011, 02:10 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
@me.raviraj007: not a good idea to put your full e-mail address in clear text on the internet. You should edit/mask it to prevent robotic search tools to recognize it. Anyway, please keep discussion on the forum, since any information related to the topic of this thread might serve to others as future reference and knowledge.

The suggested link is accessible from here. By the way, here is a transcript of the information from Bash FAQ, version 4.12, for Bash version 4.2. This document is Copyright 1995-2010 by Chester Ramey.
Code:
C1) How does bash differ from sh, the Bourne shell?

This is a non-comprehensive list of features that differentiate bash
from the SVR4.2 shell.  The bash manual page explains these more
completely.

Things bash has that sh does not:
	long invocation options
	[+-]O invocation option
	-l invocation option
	`!' reserved word to invert pipeline return value
	`time' reserved word to time pipelines and shell builtins
	the `function' reserved word
	the `select' compound command and reserved word
	arithmetic for command: for ((expr1 ; expr2; expr3 )); do list; done
	new $'...' and $"..." quoting
	the $(...) form of command substitution
	the $(<filename) form of command substitution, equivalent to
		$(cat filename)
	the ${#param} parameter value length operator
	the ${!param} indirect parameter expansion operator
	the ${!param*} prefix expansion operator
	the ${param:offset[:length]} parameter substring operator
	the ${param/pat[/string]} parameter pattern substitution operator
	expansions to perform substring removal (${p%[%]w}, ${p#[#]w})
	expansion of positional parameters beyond $9 with ${num}
	variables: BASH, BASHPID, BASH_VERSION, BASH_VERSINFO, UID, EUID, REPLY,
		   TIMEFORMAT, PPID, PWD, OLDPWD, SHLVL, RANDOM, SECONDS,
		   LINENO, HISTCMD, HOSTTYPE, OSTYPE, MACHTYPE, HOSTNAME,
		   ENV, PS3, PS4, DIRSTACK, PIPESTATUS, HISTSIZE, HISTFILE,
		   HISTFILESIZE, HISTCONTROL, HISTIGNORE, GLOBIGNORE, GROUPS,
		   PROMPT_COMMAND, FCEDIT, FIGNORE, IGNOREEOF, INPUTRC,
		   SHELLOPTS, OPTERR, HOSTFILE, TMOUT, FUNCNAME, histchars,
		   auto_resume, PROMPT_DIRTRIM, BASHOPTS, BASH_XTRACEFD
	DEBUG trap
	ERR trap
	variable arrays with new compound assignment syntax
	redirections: <>, &>, >|, <<<, [n]<&word-, [n]>&word-, >>&
	prompt string special char translation and variable expansion
	auto-export of variables in initial environment
	command search finds functions before builtins
	bash return builtin will exit a file sourced with `.'
	builtins: cd -/-L/-P, exec -l/-c/-a, echo -e/-E, hash -d/-l/-p/-t.
		  export -n/-f/-p/name=value, pwd -L/-P,
		  read -e/-p/-a/-t/-n/-d/-s/-u/-i/-N,
		  readonly -a/-f/name=value, trap -l, set +o,
		  set -b/-m/-o option/-h/-p/-B/-C/-H/-P,
		  unset -f/-v, ulimit -i/-m/-p/-q/-u/-x,
		  type -a/-p/-t/-f/-P, suspend -f, kill -n,
		  test -o optname/s1 == s2/s1 < s2/s1 > s2/-nt/-ot/-ef/-O/-G/-S
	bash reads ~/.bashrc for interactive shells, $ENV for non-interactive
	bash restricted shell mode is more extensive
	bash allows functions and variables with the same name
	brace expansion
	tilde expansion
	arithmetic expansion with $((...)) and `let' builtin
	the `[[...]]' extended conditional command
	process substitution
	aliases and alias/unalias builtins
	local variables in functions and `local' builtin
	readline and command-line editing with programmable completion
	command history and history/fc builtins
	csh-like history expansion
	other new bash builtins: bind, command, compgen, complete, builtin,
				 declare/typeset, dirs, enable, fc, help,
				 history, logout, popd, pushd, disown, shopt,
				 printf, compopt, mapfile
	exported functions
	filename generation when using output redirection (command >a*)
	POSIX.2-style globbing character classes
	POSIX.2-style globbing equivalence classes
	POSIX.2-style globbing collating symbols
	egrep-like extended pattern matching operators
	case-insensitive pattern matching and globbing
	variable assignments preceding commands affect only that command,
		even for builtins and functions
	posix mode and strict posix conformance
	redirection to /dev/fd/N, /dev/stdin, /dev/stdout, /dev/stderr,
		/dev/tcp/host/port, /dev/udp/host/port
	debugger support, including `caller' builtin and new variables
	RETURN trap
	the `+=' assignment operator
	autocd shell option and behavior
	command-not-found hook with command_not_found_handle shell function
	globstar shell option and `**' globbing behavior
	|& synonym for `2>&1 |'
	;& and ;;& case action list terminators
	case-modifying word expansions and variable attributes
	associative arrays
	coprocesses using the `coproc' reserved word and variables
	shell assignment of a file descriptor used in a redirection to a variable

Things sh has that bash does not:
	uses variable SHACCT to do shell accounting
	includes `stop' builtin (bash can use alias stop='kill -s STOP')
	`newgrp' builtin
	turns on job control if called as `jsh'
	$TIMEOUT (like bash $TMOUT)
	`^' is a synonym for `|'
	new SVR4.2 sh builtins: mldmode, priv

Implementation differences:
	redirection to/from compound commands causes sh to create a subshell
	bash does not allow unbalanced quotes; sh silently inserts them at EOF
	bash does not mess with signal 11
	sh sets (euid, egid) to (uid, gid) if -p not supplied and uid < 100
	bash splits only the results of expansions on IFS, using POSIX.2
		field splitting rules; sh splits all words on IFS
	sh does not allow MAILCHECK to be unset (?)
	sh does not allow traps on SIGALRM or SIGCHLD
	bash allows multiple option arguments when invoked (e.g. -x -v);
		sh allows only a single option argument (`sh -x -v' attempts
		to open a file named `-v', and, on SunOS 4.1.4, dumps core.
		On Solaris 2.4 and earlier versions, sh goes into an infinite
		loop.)
	sh exits a script if any builtin fails; bash exits only if one of
		the POSIX.2 `special' builtins fails

C2)  How does bash differ from the Korn shell, version ksh88?

Things bash has or uses that ksh88 does not:
	long invocation options
	[-+]O invocation option
	-l invocation option
	`!' reserved word
	arithmetic for command: for ((expr1 ; expr2; expr3 )); do list; done
	arithmetic in largest machine-supported size (intmax_t)
	posix mode and posix conformance
	command hashing
	tilde expansion for assignment statements that look like $PATH
	process substitution with named pipes if /dev/fd is not available
	the ${!param} indirect parameter expansion operator
	the ${!param*} prefix expansion operator
	the ${param:offset[:length]} parameter substring operator
	the ${param/pat[/string]} parameter pattern substitution operator
	variables: BASH, BASH_VERSION, BASH_VERSINFO, BASHPID, UID, EUID, SHLVL,
		   TIMEFORMAT, HISTCMD, HOSTTYPE, OSTYPE, MACHTYPE,
		   HISTFILESIZE, HISTIGNORE, HISTCONTROL, PROMPT_COMMAND,
		   IGNOREEOF, FIGNORE, INPUTRC, HOSTFILE, DIRSTACK,
		   PIPESTATUS, HOSTNAME, OPTERR, SHELLOPTS, GLOBIGNORE,
		   GROUPS, FUNCNAME, histchars, auto_resume, PROMPT_DIRTRIM
	prompt expansion with backslash escapes and command substitution
	redirection: &> (stdout and stderr), <<<, [n]<&word-, [n]>&word-, >>&
	more extensive and extensible editing and programmable completion
	builtins: bind, builtin, command, declare, dirs, echo -e/-E, enable,
		  exec -l/-c/-a, fc -s, export -n/-f/-p, hash, help, history,
		  jobs -x/-r/-s, kill -s/-n/-l, local, logout, popd, pushd,
		  read -e/-p/-a/-t/-n/-d/-s/-N, readonly -a/-n/-f/-p,
		  set -o braceexpand/-o histexpand/-o interactive-comments/
		  -o notify/-o physical/-o posix/-o hashall/-o onecmd/
		  -h/-B/-C/-b/-H/-P, set +o, suspend, trap -l, type,
		  typeset -a/-F/-p, ulimit -i/-q/-u/-x, umask -S, alias -p,
		  shopt, disown, printf, complete, compgen, compopt, mapfile
	`!' csh-style history expansion
	POSIX.2-style globbing character classes
	POSIX.2-style globbing equivalence classes
	POSIX.2-style globbing collating symbols
	egrep-like extended pattern matching operators
	case-insensitive pattern matching and globbing
	`**' arithmetic operator to do exponentiation
	redirection to /dev/fd/N, /dev/stdin, /dev/stdout, /dev/stderr
	arrays of unlimited size
	TMOUT is default timeout for `read' and `select'
	debugger support, including the `caller' builtin
	RETURN trap
	Timestamps in history entries
	{x..y} brace expansion
	The `+=' assignment operator
	autocd shell option and behavior
	command-not-found hook with command_not_found_handle shell function
	globstar shell option and `**' globbing behavior
	|& synonym for `2>&1 |'
	;& and ;;& case action list terminators
	case-modifying word expansions and variable attributes
	associative arrays
	coprocesses using the `coproc' reserved word and variables
	shell assignment of a file descriptor used in a redirection to a variable

Things ksh88 has or uses that bash does not:
	tracked aliases (alias -t)
	variables: ERRNO, FPATH, EDITOR, VISUAL
	co-processes (bash uses different syntax)
	weirdly-scoped functions
	typeset +f to list all function names without definitions
	text of command history kept in a file, not memory
	builtins: alias -x, cd old new, newgrp, print,
		  read -p/-s/var?prompt, set -A/-o gmacs/
		  -o bgnice/-o markdirs/-o trackall/-o viraw/-s,
		  typeset -H/-L/-R/-Z/-A/-ft/-fu/-fx/-t, whence
	using environment to pass attributes of exported variables
	arithmetic evaluation done on arguments to some builtins
	reads .profile from $PWD when invoked as login shell

Implementation differences:
	ksh runs last command of a pipeline in parent shell context
	bash has brace expansion by default (ksh88 compile-time option)
	bash has fixed startup file for all interactive shells; ksh reads $ENV
	bash has exported functions
	bash command search finds functions before builtins
	bash waits for all commands in pipeline to exit before returning status
	emacs-mode editing has some slightly different key bindings

C3)  Which new features in ksh-93 are not in bash, and which are?

This list is current through ksh93t+ (05/05/2009)

New things in ksh-93 not in bash-4.2:
	floating point arithmetic and variables
	math library functions
	${!name[sub]} name of subscript for associative array
	`.' is allowed in variable names to create a hierarchical namespace
	more extensive compound assignment syntax
	discipline functions
	KEYBD trap
	variables: .sh.edchar, .sh.edmode, .sh.edcol, .sh.edtext, .sh.version,
		   .sh.name, .sh.subscript, .sh.value, .sh.match, HISTEDIT
	backreferences in pattern matching (\N)
	`&' operator in pattern lists for matching (match all instead of any)
	exit statuses between 0 and 255
	FPATH and PATH mixing
	lexical scoping for local variables in `ksh' functions
	no scoping for local variables in `POSIX' functions
	$''  \C[.collating-element.] escape sequence
	-C/-I invocation options
	print -f (bash uses printf)
	`fc' has been renamed to `hist'
	`.' can execute shell functions
	getopts -a
	printf %B, %H, %P, %R, %Z modifiers, output base for %d, `=' flag
	read -n/-N differ/-v
	set -o showme/-o multiline (bash default)
	`sleep' and `getconf' builtins (bash has loadable versions)
	typeset -n and `nameref' variables
	[[ -R name ]] (checks whether or not name is a nameref)
	typeset -C/-S/-T/-X/-h/-s
	experimental `type' definitions (a la typedef) using typeset
	array expansions ${array[sub1..sub2]} and ${!array[sub1..sub2]}
	associative array assignments using `;' as element separator
	command substitution $(n<#) expands to current byte offset for fd N
	new '${ ' form of command substitution, executed in current shell
	new >;/<>;/<#pat/<##pat/<#/># redirections
	brace expansion printf-like formats 

New things in ksh-93 present in bash-4.2:
	associative arrays
	[n]<&word- and [n]>&word- redirections (combination dup and close)
        for (( expr1; expr2; expr3 )) ; do list; done - arithmetic for command
        ?:, ++, --, `expr1 , expr2' arithmetic operators
	expansions: ${!param}, ${param:offset[:len]}, ${param/pat[/str]},
		    ${!param*}
	compound array assignment
	negative subscripts for indexed array variables
	the `!' reserved word
	loadable builtins -- but ksh uses `builtin' while bash uses `enable'
	new $'...' and $"..." quoting
	FIGNORE (but bash uses GLOBIGNORE), HISTCMD
	brace expansion and set -B
	changes to kill builtin
	`command', `builtin', `disown' builtins
	echo -e
	exec -c/-a
	printf %T modifier
	read -A (bash uses read -a)
        read -t/-d
	trap -p
	`.' restores the positional parameters when it completes
	set -o notify/-C
	set -o pipefail
	set -G (-o globstar) and **
	POSIX.2 `test'
	umask -S
	unalias -a
	command and arithmetic substitution performed on PS1, PS4, and ENV
	command name completion, TAB displaying possible completions
	ENV processed only for interactive shells
	The `+=' assignment operator
	the `;&' case statement "fallthrough" pattern list terminator
	csh-style history expansion and set -H
	negative offsets in ${param:offset:length}
	redirection operators preceded with {varname} to store fd number in varname
	DEBUG can force skipping following command
	[[ -v var ]] operator (checks whether or not var is set)
 
Old 04-13-2011, 12:52 AM   #5
me.raviraj007
LQ Newbie
 
Registered: Apr 2011
Posts: 9

Rep: Reputation: 0
Thumbs up

Hello,
Thanks for your advice you are right in hurry to know abt the thing i gave it. from now onwards i will keep take care of it.

Thanks,
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Globbing using Korn Shell metallica1973 Programming 1 12-05-2007 04:56 PM
korn shell tutorial/course kapilcool Linux - Certification 2 11-13-2006 09:18 PM
Korn Shell PS1 c19h28O2 Linux - Newbie 4 04-25-2006 06:56 AM
Korn shell and Arrays jpc82 Programming 1 06-28-2005 02:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration