Linux shell之seq用法

来源:互联网 发布:mysql数据库免费吗 编辑:程序博客网 时间:2024/05/18 01:16


转自http://ju.outofmemory.cn/entry/66928

$ seq 1000   #起始默认是 1,间隔默认也是1$ seq 2 1000  #间隔默认是1$ seq 1 3 10    #从1到10,间隔为3,结果是:1 4 7 10
#!/bin/bashfor i in `seq 1 10`do  echo eth$i does not have a 1000 card!!done

Linux循环遍历文件写法:

for file in `ls /etc/sysconfig/network-scripts/ifcfg-*`do  echo $filedone

以下是本人写的某脚本:

#!/bin/bashfor file in `ls /etc/sysconfig/network-scripts/ifcfg-*`do  i=${file##*-}  #echo now checking $i  if [ `ifconfig $i | grep 10000base | wc -l` -ge 1 ]; then    id = `cat /proc/interrupts | grep $i | grep -v $i- | awk '{print $1}'`    echo 'ff' > /proc/irq/${id%:*}/smp_affinity    echo $i optimized.  fidone
0 0