ChinaUnix.net
相关文章推荐:

shell 字符串数组

突然想用shell写个像结构体那样子的数组,就是在数组里放置好多字符串。 我自己试验了一下 str=( "IP address" "Local directory" "remote directory" ) 按照上面的做法,通过${#str} 得到的值是10,不是我想要的3。 这应该怎么才能获取正确的值。

by 一世缥缈 - Shell - 2014-06-18 14:13:46 阅读(13224) 回复(6)

相关讨论

ERROR_FLAG_LIST[0]='Connection timed out' ERROR_FLAG_LIST[1]='Not connected' 想通过这种方式定义数组,然后再这样: echo ${error_flag_string} grep ${error_flag_string} $LOG_PATH/$LOG_FILE > /dev/null 可是打印却是这样: Connection timed out Not connected Connection timed out Not connected 大神指教,为什么 'Connection timed out' 不是作为一个完整字符串存在,被切割了? 我想让它...

by VIP_fuck - Shell - 2016-03-10 17:28:51 阅读(1055) 回复(4)

shell 字符串数组处理 -------------------------------------------------------------------------------- 这段代码用来处理系统中的某个程序(脚本)的调用,但是又不知道这个程序文件的具体位置,只是知道可能存在的位置。有点智能的味道哦。 -------------------------------------------------------------------------------- exp_cmds="$BASE_DIR/$old_version/bin/exp_my_db \ $BASE_DIR/$old_version/bin/...

by phybbice - Linux文档专区 - 2010-01-26 16:15:32 阅读(2478) 回复(0)

如何用shell判断一个字符串是否是json数组

by Auroracxy - Shell - 2013-11-25 17:04:21 阅读(4409) 回复(6)

字符串是以TAB分隔的,想转为数组怎么做呢。谢谢大神了,急!

by witer666 - Linux新手园地 - 2013-02-04 11:06:45 阅读(1656) 回复(0)

1.# **|uniq -c 1 1 1 9 1 36 1 69 1 76 2. 把这些值付给数组,然后调用数组元素运算。 这样的东西在shell写如何写 这个在perl用hash比较容易,在shell中不知道如何做了 [ 本帖最后由 huanghaojie 于 2009-2-18 15:04 编辑 ]

by huanghaojie - Shell - 2009-02-18 15:06:24 阅读(1983) 回复(5)

[color="#000000"]$ A=(a b c def)EybLinux联盟 EybLinux联盟 ==================================================EybLinux联盟 $ echo ${A[@]} //取全部元素EybLinux联盟 a b c defEybLinux联盟 EybLinux联盟 =================================================EybLinux联盟 EybLinux联盟 $ echo ${A[0]} //取第一个元素EybLinux联盟 aEybLinux联盟 EybLinux联盟 =================================================EybLinux联...

by Aquester - Linux文档专区 - 2008-07-09 12:31:14 阅读(986) 回复(0)

shell数组 Bash中还可以使用数组变量,其赋值有两种: (1) name = (value1 ... valuen) 此时下标从0开始 (2) name[index] = value 数组下标的范围没有任何限制,同时也不必使用连续的分量. -------------------------------------------------------------------------------- $ A=(a b c def) ================================================== $ echo ${A[@]} //取全部元素 a b c def =========================================...

by hubble.king - Linux文档专区 - 2008-01-22 09:32:02 阅读(942) 回复(0)

#!/bin/bash A=(a b c def) echo ${A[@]} //取全部元素 echo ${A[0]} //取第一个元素 echo ${#A[@]} //取得元素3的长度 echo ${#A} //取得元素3的长度 echo ${#A[3]} //取得元素3的长度 A[3]=ghb //将第三个元素重新赋值 echo ${A[@]} $ echo ${A[@]} 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/11765/showart_312287.html

by ghbspecial - Linux文档专区 - 2007-06-01 18:38:33 阅读(848) 回复(0)

请教各位高手: 有文件tmp.txt: jhgdhfgjhdfjkg => hdfghkjdhfg hfghdjfhgkjdh => hfgjhdkjfhgkj 我欲将$1即第一个域中的字符循环读入数组a中 然后 echo "$a" 循环显示出来   用while read line do for i;do a=awk '{print $1}' echo "$a" done done<

by gehao99 - Shell - 2004-12-29 15:57:46 阅读(6190) 回复(9)

求助,获取系统时间,并将系统时间组织称字符串20150714的格式

字符串

by framily - C/C++ - 2015-07-16 13:21:22 阅读(1786) 回复(13)