"Csh, tcsh"의 두 판 사이의 차이

10번째 줄: 10번째 줄:
{|  
{|  
! sh !! csh
! sh !! csh
|- valign='top'
|- style='vertical-align:top'
|
|
<source lang='bash'>
<source lang='bash'>
25번째 줄: 25번째 줄:
endif
endif
</source>
</source>
|-
|- style='vertical-align:top'
|
|
<source lang='bash'>
<source lang='bash'>
48번째 줄: 48번째 줄:
end
end
</source>
</source>
|-
|- style='vertical-align:top'
|
|
<source lang='bash'>
<source lang='bash'>

2014년 9월 8일 (월) 00:55 판

1 개요

C shell; csh, tcsh
C쉘, C 셸
  • 빌 조이가 개발한 유닉스용 셸
  • C 언어를 전신으로 하여 만들어짐

 

2 비교

sh csh
#!/bin/sh
if [ $days -gt 365 ]; then
   echo This is over a year.
fi
#!/bin/csh
if ( $days > 365 ) then
   echo This is over a year.
endif
#!/bin/sh
i=2
j=1
while [ $j -le 10 ]; do
   echo '2 **' $j = $i
   i=`expr $i '*' 2`
   j=`expr $j + 1`
done
#!/bin/csh
set i = 2
set j = 1
while ( $j <= 10 )
   echo '2 **' $j = $i
   @ i *= 2
   @ j++
end
#!/bin/sh
for i in d*
do
   case $i in
      d?) echo $i is short ;;
      *) echo $i is long ;;
   esac
done
#!/bin/csh
foreach i ( d* )
   switch ( $i )
      case d?:
         echo $i is short
         breaksw
      default:
         echo $i is long
   endsw
end

3 같이 보기

4 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}