`
dylan.wu
  • 浏览: 134139 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

shell下list的使用

 
阅读更多

1、定义 list1=(a b c)

2、获取item个数: ${#list1[@]}

3、获取某个item:${list1[0]},${list1[1]}

4、转换成以空格分隔各item的字符串: str=${list1[*]}

5、把以空格分隔的字符串转换成list:str=a" "b" "c; list1=($str); echo ${#list1[@]};

这条用的场所,主要是把ls, find等命令的返回值转换成list;比如:

str=$(ls ./); list1=($str); 也可以写成list1=($(ls ./));

 

分享到:
评论

相关推荐

    SHELL命令List

    shell命令详解list。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

    stl中list,map的使用及linux下shell调用

    stl中list,map的使用及讲解了linux下的shell调用

    Shell中创建序列和数组(list、array)的方法

    主要介绍了Shell中创建序列和数组(list、array)的方法,本文讲解了seq方法生成以及通过内部{begin..end}生成法,需要的朋友可以参考下

    java调用shell(包含有参数的调用)

    java调用shell 包含简单的编写shell文件 调用含有参数的shell文件

    ADBShell操作手册

    adb shell pm list packages [options] <FILTER> 7 adb shell pm path <PACKAGE> 10 adb shell pm clear <PACKAGE> 10 文件管理命令(File Manger) 10 adb pull <remote> [local] 10 adb push <local> <remote> 10 ...

    【原创】【源代码】myshell:操作系统编程-自己用C语言写的Linux下的Shell

    本人原创的操作系统上机作业(源代码),自己编写一个简单的Linux下的shell(a simple myshell)!原题见William Stallings写的《Operating Systems - Internals and Design Principles》(操作系统--内核与设计原则...

    实验七 shell编程

    8 ls list the files in this directory 9 cat display a file on the screen Please enter a number or a name for the action you wish: 要求有清屏功能,能正确地执行各项命令并显示。

    android adb shell 命令大全

    android adb shell 命令大全 1. 显示系统中全部Android平台: android list targets 2. 显示系统中全部AVD(模拟器): android list avd 3. 创建AVD(模拟器): android create avd --name 名称 --...

    linux实验七 shell编程

    8 ls list the files in this directory 9 cat display a file on the screen Please enter a number or a name for the action you wish: 要求有清屏功能,能正确地执行各项命令并显示。

    gnome-shell-extension-window-list-3.32.1-14.el8.noarch.rpm

    官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装

    适用于stm32的shell代码和例程

    内置 "cmd-list" 命令获取所有命令列表 支持 tab 键补全命令 支持 backspace 回退,这个在 putty 上有 bug ,还没修复。在secureCRT正常。 支持上下箭头回溯历史,这个功能没有做的很好; 支持左右箭头编辑当前...

    改进的shell下mp3播放器源码

    Shell下mp3播放器playmp3list源码,修改了部分bug,支持中文,占资源少。

    simple-shell.c

    UNIX Shell and History Feature 1.The first task is to modify the main() function in Figure 3.36 so... The user will be able to list the command history by entering the command history at the osh> prompt.

    AWSCLI助手aws-shell.zip

    aws-shell 是集成了 Shell 的 AWS CLI,是 AWS CLI 的交互式生产力助推器。主要特性:命令和选项自动完成功能...aws> dynamodb list-tables --output text TABLENAMES First TABLENAMES Second TABLENAMES Third

    Git与Git Shell的安装+使用(远程服务器)-windows

    详见word文档 安装包,详见如下,按照顺序进行安装: 1.运行cmd,输入命令: %SYSTEMROOT%\SYSTEM32\REGSVR32.EXE %SYSTEMROOT%\SYSTEM32\WUAUENG.DLL ...4.查看配置的用户信息:git config --list

    Jess__The_Java_Expert_System_Shell

    The syntax of the Jess language is discussed, and a comprehensive list of supported functions ispresented. A guide to calling Java functions from Jess, and to extending Jess by writing Java code, is ...

    jxse-shell-2.5

    ===附上linux下使用jxtashell的说明=== (windows用户参加jxse-shell-src-2.5/win32/Jxta_Readme.html说明) Linux具体步骤如下: leekwen@leekwen:~$ unzip jxse-shell-2.5.zip leekwen@leekwen:~$ cd jxse-shell-...

    RHCE RHCA Shell 运维

    Wicked Cool Shell Scripts—101 Scripts for Linux, Mac OS X, and Unix Systems Introduction Chapter 1 - The Missing Code Library Chapter 2 - Improving on User Commands Chapter 3 - Creating ...

    101 shell script for linux and unix

    Web and Internet Administration Chapter 10 - Internet Server Administration Chapter 11 - Mac OS X Scripts Chapter 12 - Shell Script Fun and Games Afterword Index List of ...

Global site tag (gtag.js) - Google Analytics