美文网首页
declare : shell, definate the at

declare : shell, definate the at

作者: cutelittlePanda | 来源:发表于2018-03-14 11:56 被阅读0次

    syntax:

    declare [-aixr] var_name

    -a   var_name is an array

    -i     integer

    -x  set var_name as the system variable, the same function as export

    -r   readonly variable, cannot change, cannot unset

    examples:

    $ declare var[1]="setting 1"

    $ echo ${var[1]}

    setting 1

    $ declare var[2]="configuration 2"

    $ echo ${var[2]}

    configuration 2

    $ declare var[3]="defination 3"

    $ echo ${var[3]}

    defination 3

    $ echo "${var[1]},${var[2]},${var[3]}"

    setting 1,configuration 2,defination 3

    相关文章

      网友评论

          本文标题:declare : shell, definate the at

          本文链接:https://www.haomeiwen.com/subject/yjebkxtx.html