Regarding 'for' loop in KornShell

后端 未结 4 1233
南旧
南旧 2020-12-20 03:56

Is there a way to implement the following using \'for\' in KornShell (ksh)? Here is the C equivalent:

for(i=1;i<20;i++)
{
    printf(\"%d\",i);
}
<         


        
4条回答
  •  梦毁少年i
    2020-12-20 04:25

    ksh93 offers braceexpansion also if "braceexpand" is "on". Check with "set -o" and then use curly braces {}

    for i in {1..20}
    do
      print $i
    done
    

提交回复
热议问题