-
关联数组
ssharray[$i]=${script_file}
查看全部 -
.sh
查看全部 -
冒号改成分号
查看全部 -
截图
查看全部 -
场景控制脚本(上)
vi monitor_man.sh
-------------
#!/bin/bash
resettem=$(tput sgr0)
declare -A ssharray
i=0
numbers=""
for script_file in `ls -I "monitor_man.sh" ./`
do
echo -e "\e[1;35m" "The Script:" ${i} '==>' ${resettem} ${script_file}
i=(($i+1))
done查看全部 -
关联数组:可以使用字符串作为数组索引
普通数组:只能使用整数作为数组索引
申明关联数组变量:
declare -A ass_array1
赋值:数组名[索引]=变量值
ass_array1[index1]=pear
shell中的数组分为普通数组和关联数组;
普通数组的基本赋值:arr=(a b c) arr[index]=adeclare -A ass_array1 #申明关联数组变量
ass_array1[index1]=pear #使用关联数组查看全部 -
shell高亮显示:echo -e 终端颜色 + 显示内容 + 结束后的颜色
echo -e "\e[1;30m" "xxx" $(tput sgr0) //-e 颜色指令 参数1 具体颜色 参数2 显示内容 参数3 重置颜色
echo -e "\e[1;30m" "Jason say hi!" $(tput srg0)
echo -e "\e[1;35m Jason say hi \e[1;30m"
#字符高亮显示 echo -e "\e[1;35m" "sting" "\e[1;0m"
resettem=$(tput sgr0) #恢复系统默认高亮显示tput sgr0或\e[1;0m
"\e[1;35m" +string+ resettem #设置字符串高亮
declare -A ssharray #定义关联数组
ssharray[$i]=${script_file} #使用关联数组查看全部 -
场景脚本结构
查看全部 -
Shell脚本常用场景# 提取系统信息# 应用分析# 日志分析
##知识点
##1 执行脚本,如何让终端进行高亮显示
##2 shell如何定义关联数组
#!/bin/bash
resettem=$(tput sgr0)
declare -A ssharray
i=0
numbers=""
for script_file in `ls -I "monitor_man.sh" ./`
do
echo -e '\e[1;35m'"The Script:" ${i} '===>' ${resettem} ${script_file}
grep -E "^\#Program function" ${script_file}
ssharray[$i]=${script_file}
numbers="${numbers} | ${i}"
i=$((i+1))
done查看全部 -
vim配置(vim编辑器操作,观看达人养成计划二的第一章)
1、设置方式分类
临时性的设置(末行模式设置)
永久性的设置(修改vimrc文件)
2、高亮模式设置:
syntax on/off(末行模式下,临时生效)末行模式“:/syntax”可以搜索到syntax所在位置
/etc/vimrc或家目录下/home/jeson/.vimrc(添加syntax on/off,设置永久的,其中在用户家目录设置的只对该用户保存永久设置)
临时性设置:
将vim编辑器中的高亮关闭:进入vim /etc/man.config中,末行模式输入syntax off
永久性设置:
进入vim /etc/vimrc 改变系统整个用户的配置,将syntax on 改为syntax off查看全部 -
场景脚本
查看全部 -
Shell脚本常用场景
# 提取系统信息
# 应用分析
# 日志分析
查看全部 -
echo 终端颜色
查看全部 -
shell常用应用场景
查看全部 -
shell高亮显示
查看全部
举报