首页 > 其他分享 >Bash: Iterate over positional parameters

Bash: Iterate over positional parameters

时间:2023-01-23 11:33:55浏览次数:52  
标签:bin over param positional vS usr env Iterate bash

 

  1. for param
    #!/usr/bin/env -vS bash
    
    for param;do
        echo $param
    done

     

  2. for ${!i}
    #!/usr/bin/env -vS bash
    
    for ((i=1;i<=$#;++i)); do
        echo ${!i}
    done

     

  3. $* $@

  4. shift
    #!/usr/bin/env -vS bash
    
    until [ -z "$1" ]; do
        echo $1
        shift
    done

     

标签:bin,over,param,positional,vS,usr,env,Iterate,bash
From: https://www.cnblogs.com/dissipate/p/17065076.html

相关文章