
shell
varyall
这个作者很懒,什么都没留下…
展开
-
shell 函数参数为数组传递
You cannot pass an array, you can only pass its elements (i.e. the expanded array).#! /bin/bashfunction f() { a=("$@") ((last_idx=${#a[@]} - 1)) b=${a[last_idx]} unset a[last_idx]转载 2015-11-21 19:30:06 · 5121 阅读 · 0 评论 -
常用的shell脚本
1、脚本之间传递参数 "1.sh"的脚本,接受参数。如下,如果有一个参数则赋值个sourceFile这个变量,否则用默认值。 Shell代码 #!/bin/bash LANG=en_US.UTF-8 #get parameters sourceFile="/data/log/abc" if [ $# == 1 ]转载 2015-11-22 01:28:01 · 517 阅读 · 0 评论 -
在shell中如何判断一个变量是否为空
在shell中如何判断一个变量是否为空判断一个脚本中的变量是否为空,我写了一个这样的shell脚本: C代码 #!/bin/sh #filename: test.sh para1= if [ ! -n $para1 ]; then echo "IS NULL" else echo "NOT NULL" fi转载 2018-01-23 15:51:40 · 126806 阅读 · 0 评论