Hi,
I hope this belongs in the "Programming" section (I'm new to LQ)....
I am a junior FreeBSD sysadmin and really like csh (standard shell on our FreeBSD machines). Sometimes the need for a while loop arises. These last couple of weeks I have been forced to do certain stuff in bourne shell because my csh skills are not op to the task. This is a bit cumbersome and frustrating: how difficult can csh's while implementation be ?
I've searched a lot of websites (including LQ) but haven't been able to translate a simple while loop into correct csh syntax. Csh seems a bit elusive
Example:
file "kwaak.txt" contains :
a
b
c
1
2
3
I'm able to do stuff for each entry in bourne by issuing:
cat kwaak.txt | while read example ; do echo "Displaying $example" ; done
Output:
Displaying a
Displaying b
Displaying c
Displaying 1
Displaying 2
Displaying 3
If I issue the same command while in csh things obviously don't work because of the different syntax that is required by csh. After asking several coworkers and abusing google for quite some time I haven't been able to find the correct csh syntax.
My solution now is to enter a traditional bourne shell and do it there or to write a script that does it; both are not ideal.
Perhaps somebody on this forum can help out?
Any help would be greatly appreciated!
Regards,
FuX