Shell-04】的更多相关文章

shell编程中用户输入处理1.命令行参数2.脚本运行时获取输入 命令行参数 通过空格来进行分割的位置参数 :$+position $0,$1,$2 ....$0 :程序名$1,$2,$3 ... $910及其以上的${10} add.sh #/bin/bash echo "file is $0" echo "1->$1" echo "2->$2" echo "10->${10}" echo "11…
一. 数字测试 格式:n1  -op  n2 测试操作op: eq/ne/le/ge/lt/gt    -->    等于/不等于/小于等于/大于等于/小于/大于 1. 数字比较可以使用特殊的(())操作符,用法更接近于C语言,见数字测试. 二. 字符串测试 s1 = s2 #s1与s2是否相同 s1 != s2  #s1与s2是否不相同 s1 < s2 #s1是否小于s2 s1 > s2 #s1是否大于s2 -n s1 #s1长度是否大于0 -z s1  #s1长度是否为0 1. 字符…
一.字符串的处理   1.字符串截取 1.1 s{}表达式  ${变量名:起始位置:长度} (从0开始) n=number (n="number") echo ${#n}   ----> 6 echo ${n:0:4}----> numb echo ${n:1:3} ---> umb 1.2 使用 expr substr  格式:expr substr "$变量名" 起始位置 长度(从1开始) n=number expr substr "…
环境准备 python版本2.6git版本 1.8.4.1ruby版本ruby-2.0.0-p353gitlab-shell版本 v1.8.0gitlab版本6.4.3 因centos6系列的python版本是2.6的,已经支持,所以不必升级python版本.在centos5下面需要升级python版本>2.5 安装epel的yum源 1 yum -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.n…
往文件中所有添加指定的前缀 方法一:open方法 f_r = open('text.txt') f_w = open('text_new.txt','w+') i = 0 while True: i += 1 line = f_r.readline() if not line: break f_w.write('%02d'%i + '.python'+ ' ' +line) f_r.close() f_w.close() f_wr = open('text_new.txt','r') lines…
目录 00. 目录 01. Shell简介 02. Shell分类 03. 交互式shell和非交互式shell 04. 登录shell和非登录shell 05. Shell类型 06. 参考 00. 目录 @ 参考博客: https://blog.csdn.net/dengjin20104042056/article/details/94669639 01. Shell简介 在计算机科学中,Shell俗称壳(用来区别于核),是指"为使用者提供操作界面"的软件(命令解析器).它类似于D…
ubuntu16.04 安装power shell # Download the Microsoft repository GPG keys wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb # Register the Microsoft repository GPG keys sudo dpkg -i packages-microsoft-prod.deb # Upda…
Ubunut 16.04默认使用nautilus进行管理资源文件夹,nautilus默认是支持参数传递的. 使用: nautilus /dirurl 打开当前文件夹(可以使用$PWD代替): nautilus "$(pwd)" 封装: #新建文件sudo vim /usr/bin/opendir#写入如下内容nautilus "$(pwd)" >/dev/null 2>&1#修改权限sudo chmod +x /usr/bin/opendir 使…
现象: shell脚本中source aaa.sh时提示 source: not found 原因: ls -l `which sh` 提示/bin/sh -> dash 这说明是用dash来进行解析的. 改回方法: 命令行执行:sudo dpkg-reconfigure dash 在界面中选择no 再ls -l `which sh` 提示/bin/sh -> bash 修改成功,source可以用了~ 从 ubuntu 6.10 开始,ubuntu 就将先前默认的bash shell 更换成…
http://askubuntu.com/questions/465531/how-to-make-a-shell-file-execute-by-double-click up vote7down voteaccepted To run your script by double clicking on its icon, you will need to create a .desktop file for it: [Desktop Entry] Name=My script Comment…