C shell ( csh ) is a UNIX command shell with a built-in scripting language, developed by Bill Joy , an active developer of BSD UNIX and creator of the vi editor, in 1979 .
| C shell | |
|---|---|
| Type of | UNIX shell |
| Author | Bill joy |
| Developer | |
| Written on | Si |
| operating system | BSD , UNIX , Linux , Mac OS X |
| First edition | 1978 |
| Latest version | 6.20.00 ( November 24, 2016 [1] ) |
| License | BSD License |
Based on the shell code of the sixth version of UNIX . The scripting language is not inferior to the Bourne shell in power, but differs in syntax. While Bourne copied all the major operators from Algol 68 , Bill Joy used C as a layout, probably guided by his preferences and those of other BSD UNIX users.
In the early 1990s, the C shell was criticized for its ambiguity and laconicism of the interpreter, which stops the execution of the script, but does not provide any details about what really happened. Sometimes csh scripts did not work at all as the user expected. There were also situations where the interpreter rejected seemingly consistent lines of code.
The C shell came in with 4.1BSD and still remains the base part of all its descendants, including FreeBSD and OpenBSD .
Content
Comparison with Bourne shell
Condition
Bourne shell #! / bin / sh
if [ $ days -gt 365 ]
then
echo This is over a year.
fi
| C shell #! / bin / csh
if ( $ days > 365 ) then
echo This is over a year.
endif
|
Preconditioned cycle
Bourne shell #! / bin / sh
i = 2
j = 1
while [ $ j -le 10 ]
do
echo '2 **' $ j = $ i
i = ` expr $ i '*' 2`
j = ` expr $ j + 1`
done
| C shell #! / bin / csh
set i = 2
set j = 1
while ( $ j < = 10 )
echo '2 **' $ j = $ i
@ i * = 2
@ j ++
end
|
Counter Cycle
Bourne shell #! / bin / sh
for i in d *
do
case $ i in
d? ) echo $ i is short ;;
* ) echo $ i is long ;;
esac
done
| C shell #! / bin / csh
foreach i ( d * )
switch ( $ i )
case d ?:
echo $ i is short
breaksw
default :
echo $ i is long
endsw
end
|
Notes
- β Zoulas, Christos (November 24, 2016), tcsh-6.20.00 is now available! , < http://mx.gw.com/pipermail/tcsh/2016-November/005021.html > . Retrieved November 24, 2016. Archived November 25, 2016 on the Wayback Machine
See also
- Command Shell Comparison