shell
秋雪夜雨寒
这个作者很懒,什么都没留下…
展开
-
shell中的内容变量
内部变量是Linux所提供的一种特殊类型的变量,这类变量在程序中用来作出判断。在shell程序内这类变量的值是不能修改的。 表示方法 描述 $n $1 表示第一个参数,$2 表示第二个参数 ... $# 命令行参数的个数 $0 当前程序的名称 $? 前一个命令或函数的返回码 $* 以"参数1 参数2 .原创 2016-03-03 10:55:24 · 408 阅读 · 0 评论 -
如何打印一个变量指定部分的字符
如题:其实可以直接使用echo就可以了,比如下面的例子,echo ${a:3:8}表示从索引为3的位置开始(从0开始计算),然后连续打印8个字符。[root@Server exercise]# echo $a095caddec66f16b48bbffa9204ce1be7 -[root@Server exercise]# echo ${a:3:8}caddec66[root@S原创 2016-04-26 20:11:16 · 708 阅读 · 0 评论 -
自认为比较经典的shell程序
1、shell攻击原理示例#!/bin/bashecho "creating hello.c ... ..."echocat hello.c#include #include int main(void){ printf("It's generated by a shell script.\n"); system("shutdown -r 1");原创 2016-02-25 17:20:26 · 1017 阅读 · 0 评论 -
bash Redirecting_AppendingRedirecting_HereDocument_HereString_etc
refer to: man bashRedirecting Input Redirection of input causes the file whose name results from the expansion of word to be opened for reading on file descriptor n, or the stan-原创 2016-02-24 14:49:09 · 408 阅读 · 0 评论 -
Here-Document
Here-documentThe redirection operators The here-document is treated as a single word that begins after the next newline character and continues until there is a line containing only the delimi转载 2016-02-24 14:04:59 · 623 阅读 · 0 评论 -
linux_shell_HERE Document
refer to: http://blog.csdn.net/ysdaniel/article/details/6899861HERE Document是bash里面定义块变量的途径之一定义的形式为: 命令.........HERE它的作用即可以用来定义一段变量,会把命令和HERE之间的内容利用转向输入的方式交给该命令去处理。其中HERE相当于标记,可以转载 2016-02-24 12:03:56 · 304 阅读 · 0 评论 -
linux shell的here document用法(cat << EOF)
refer to: http://www.2cto.com/os/201307/231010.html linux shell的here document用法(cat 什么是Here Document Here Document 是在Linux Shell 中的一种特殊的重定向方式,它的基本的形式如下 cmd转载 2016-02-24 11:15:27 · 426 阅读 · 0 评论 -
linux中env,export, set的区别
unix shell的变量分类在Shell中有三种变量:内部变量,环境变量,用户变量。内部变量:系统提供,不用定义,不能修改环境变量:系统提供,不用定义,可以修改,可以利用export将用户变量转为环境变量.用户变量:用户定义,可以修改(1)内部变量(系统变量,环境变量,参数变量,预定义变量)内部变量是Linux所提供的一种特殊类型的变量,这类变量在程序中用来作出判断。在s转载 2016-02-24 10:03:34 · 1206 阅读 · 0 评论 -
.bash_profile 与 .bashrc 的区别
【.bash_profile 与 .bashrc 的区别】.bash_profile is executed for login shells, while .bashrc is executed for interactive non-login shells.【login shell 与 non-login shell 的区别】1、当你直接在机器login界面登陆、使用ss原创 2016-02-24 10:01:31 · 406 阅读 · 0 评论 -
ssh_两台互不信任的主机如何通过一台信任的主机传输数据
b到a,b到c都可以直接使用ssh连接,现在有一个大文件需要从a复制到c,那么需要如何做,可以参考下面的方法下面的命令需要在b上面执行ssh -l root 192.168.30.215 "cat /home/mysql/db_backup/20170602_031501.sql.gz" | ssh -l root 192.168.10.18 'cat >> /root/sql_bak.sql'ss原创 2017-07-28 17:54:25 · 418 阅读 · 0 评论