关于!
[root@zeqtx ~]# echo '!ll' !ll [root@zeqtx ~]# echo "!ll" echo "ll /bin/awk " ll /bin/awk shell常用命令与工具 cat cat<<-EOF 1.[install lamp] 2.[install lnmp] 3.[exit] EOF cat >> /etc/profile <<'EOF' $PATH EOF read格式:
read [options] varible1 varible2 ...
参数:
-p 显示提示信息
-t 超时时间
-s 取消回显
-u 绑定文件描述符作为输入
-a 后跟一个变量,该变量会被认为是个数组,然后给其赋值,默认是以空格为分割符
执行参数做为shell命令
[root@VM_153_209_centos ~]# echo $a 3 [root@VM_153_209_centos ~]# echo $b stu [root@VM_153_209_centos ~]# eval echo ${b}{1..$a} stu1 stu2 stu3 tee从标准输入读取写到出和文件
-a 追加到文件
printf a=1 b=3 printf "%.2f" `echo "scale=2;$a/$b"|bc` :空命令
echo 字体颜色 echo -e "\033[30m 黑色字zeq trainning \033[0m" echo -e "\033[31m 红色字zeq trainning \033[0m" echo -e "\033[32m 绿色字zeq trainning \033[0m" echo -e "\033[33m 黄色字zeq trainning \033[0m" echo -e "\033[34m 蓝色字zeq trainning \033[0m" echo -e "\033[35m 紫色字zeq trainning \033[0m" echo -e "\033[36m 天蓝字zeq trainning \033[0m" echo -e "\033[37m 白色字zeq trainning \033[0m" 背景颜色 echo -e "\033[40;37m 黑底白字 welcome to ze1q\033[0m" echo -e "\033[41;37m 红底白字 welcome to ze2q\033[0m" echo -e "\033[42;37m 绿底白字 welcome to ze3q\033[0m" echo -e "\033[43;37m 黄底白字 welcome to ze4q\033[0m" echo -e "\033[44;37m 蓝底白字 welcome to ze5q\033[0m" echo -e "\033[45;37m 紫底白字 welcome to ze6q\033[0m" echo -e "\033[46;37m 天蓝白字 welcome to ze7q\033[0m" echo -e "\033[47;30m 白底黑字 welcome to ze8q\033[0m" traptrap [-lp] [ [参数] 信号 ...]
参数 : shell命令
信号
HUP(1) 挂起,通常因终端掉线或用户退出而引发
INT(2) 中断,通常因按下Ctrl+C组合键而引发
QUIT(3) 退出,通常因按下Ctrl+组合键而引发
ABRT(6) 中止,通常因某些严重的执行错误而引发
ALRM(14) 报警,通常用来处理超时
TERM(15) 终止,通常在系统关机时发送
SIGTSTP 停止进程 终端来的停止信号
expect-copy-sshkey.exp
#!/usr/bin/expect if { $argc != 1 } { send_user "usage: expect expect-copy-sshkey.exp host \n" exit } #define var set host [lindex $argv 0] set password "123456" spawn ssh-copy-id -i /home/oldgirl/.ssh/id_dsa.pub "oldgirl@$host" #spawn ssh -p 50718 disdata@$host /sbin/ifconfig set timeout 60 expect { -timeout 20 "yes/no" { send "yes\r";exp_continue } "*password" { send "$password\r" } timeout { puts "expect connect timeout,pls contact zeq."; return } } expect eof exit -onexit { send_user "zeq say good bye to you!\n" }