AIX下面的for循环如何书写

sifadmwy 2015-05-13 05:03:40
第一次用AIX 很多命令都不一样。。。。今天写个脚本需要用到for循环 结果发现语法不对


for(( i=1;i<=2;i++ ))
do
echo 'i' $i
done

求指正下 网上没找到
...全文
3990 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wuwangjun 2015-08-19
  • 打赏
  • 举报
回复
#!/bin/sh # check file in current folder for file in * do if [ -f $file ]&&[ -w $file ]&& [ -r $file ] then echo "This is a file and Name is: ${file} and it's can be write and read." elif [ -d $file ] then echo "This is a directory and Name is: ${file}" fi done 代码来了,给分吧 . 用的原始的SH.
mymtom 2015-06-19
  • 打赏
  • 举报
回复
这个不是AIX的问题,是shell的问题。 Linux下用的是bash AIX一般用ksh for(( i=1;i<=2;i++ )) do echo 'i' $i done 这个是bash才支持的语法。 ksh下的循环可以这样用

i=0
n=10
while [ $i -lt $n ]; do
        echo $i
        i=`expr $i + 1`
done
sifadmwy 2015-05-14
  • 打赏
  • 举报
回复
好吧已经解决了 for i in '' 然后通过读取文本来实现循环。。。
sifadmwy 2015-05-13
  • 打赏
  • 举报
回复
没人吗。。。。。

1,195

社区成员

发帖
与我相关
我的任务
社区描述
该论坛主要探讨IBM AIX平台的安装、部署、应用开发等话题,并为网友们提供自由交流的平台。
社区管理员
  • IBM AIX社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧