随笔分类 - shell
shell中的循环语句
摘要:for语法格式 for var in list;do commands done 其中list可以包含: 1) 直接写 2)变量 在shell执行的时候会进行变量替换,上面的list变量替换之后,for循环的形式和1中的形式一模一样。但是如果为$list加上了引号,即如果写为下面的形式: shell
阅读全文
lua调用shell 脚本
摘要:Lua中,os.execute可以执行dos命令,但是返回的是系统状态码,默认输出。io.popen()也可以执行dos命令,但是返回一个文件。eg: 复制代码 代码如下: local t = io.popen('svn help')local a = t:read("*all")--a返回一个字符
阅读全文
shell sed 替代1
摘要:sed -e '/-DLUA_USE_LINUX/s/-lreadline/-lreadline -lncurses/g' Makefile > tmp mv tmp Makefile 全局换-lreadline成-lreadline -lncurses 需要这样有-DLUA_USE_LINUX 写
阅读全文
PHP 调用shell命令
摘要:可以使用的命令: popenfpassthrushell_execexecsystem 1.popen resource popen ( string command, string mode ) 打开一个指向进程的管道,该进程由派生给定的 command 命令执行而产生。 返回一个和 fopen(
阅读全文
linux建立ftp用户
摘要:#!/bin/bash sleep 1 mkdir -p /ceshi/ userdel ceshi useradd -d /ceshi -s /sbin/nologin ceshi echo mima | passwd ceshi --stdin chown -R ceshi:ceshi /ces
阅读全文
linux shell for循环使用命令中读取到的值实例
摘要:#!/bin/bash file="states" for state in `cat $file` do echo "Visit beautiful $state" done
阅读全文
浙公网安备 33010602011771号