|


| NAVIGATION |
|
Home |
|
Store |
|
|
| INSIDE MAC |
|
Television Shows |
|
Broadcast Shows |
|
Daily News Shows |
|
Special Shows |
|
|
| EVENTS |
|
|
|
|
|
|
|
|
| DAILY TIPS |
|
Design |
|
Mac OS X |
|
Mac OS X UNIX |
|
|
| COMMUNITY |
|
Surveys |
|
|
| NEWS |
|
Current |
|
Press |
|
Archive |
|
|
| FEATURES |
|
Editorial |
|
Dr. Mac |
|
Reviews |
|
Reader Reports |
|
|
| RESOURCES |
|
FAQ |
|
Documentation |
|
Learning Center |
|
MAN pages |
|
Glossary |
|
Tutorials |
|
Tips |
|
Links |
|
|
|

|
|
|
OSXFAQ Daily Unix Tricks

Week 54 - tcsh vs sh/bash (10 August 2003)
by
Adrian Mayo - Senior Editor for Mac OS X Unix
Friday - Control Constructs 2 (Looping)
The scripting language of tcsh looks very much like the 'c' programming language (hence the 'c' in tcsh) while sh/bash does not.
'for' loops:
#!/bin/tcsh
foreach word (hello goodbye au-revoir)
echo $word
end
#!/bin/sh
for word in hello goodbye au-revoir
do
echo $word
done
'while' loops:
#!/bin/sh
n=0
while [ ! $n = 10 ]
do
echo $n
n=$(expr $n + 1)
done
#!/bin/tcsh
set n = 0
while ($n != 10)
echo $n
set n = `expr $n + 1`
end
If you want to learn more about Mac OS X Unix visit the Learning Center
click.
- For beginners: the Mac OS X Unix Tutorial
- For detailed information on specific topics: Mac OS X Advanced Unix
- For answers to common problems: Mac OS X How To
|


|
Copyright © 2000-2010 Inside Mac Media, Inc. All rights reserved. |
Apple assumes no responsibility with regard to the selection, performance, or use of the products or services. All understandings, agreements, or warranties, if any, take place directly between the vendors and prospective users. |
| Apple, the Apple logo, Mac, PowerMac G4, PowerMac G5, Xserve, Xserve RAID, PowerBook, iBook, Airport, AirPort Extreme, iMac, eMac, iLife, iMovie, iCal, iPhoto, iTunes, QuickTime, FireWire, iPod, iSight, AppleWorks, Macintosh, Jaguar, Panther, Mac OS, Mac OS X and Mac OS X Server are trademarks of Apple Computer, Inc. |
|