/etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行并从/etc/profile.d目录的配置文件中搜集shell的设置./etc/bashrc:为每一个运行bash shell的用户执行此文件.当bash shell被打开时,该文件被读取.~/.bash_...
分类:
其他好文 时间:
2014-10-12 14:10:57
阅读次数:
163
需求:输入用户名和密码,认证成功后显示欢迎信息,输错三次后锁定shell:#!/bin/bash
#Authuserlogin
user="hlf"
pass="123456"
lock_file=login.lock
[-f${lock_file}]||touch${lock_file}
foriin`seq3`
do
read-p"username:"username
read-p"password:"password
if[-z"$u..
分类:
其他好文 时间:
2014-10-12 11:07:18
阅读次数:
168
最近写了一个小程序,需要用到时间,遍历作为目录的一部分
#!/bin/bash
for i in {1..30}
do
date=`date +%Y/%m/%d -d " $i days ago " `
echo $date
done
for循环,取最近n天的日期。
核心就是date=`date +%Y/%m/%d -d " $i days ago " `...
分类:
系统相关 时间:
2014-10-12 02:22:57
阅读次数:
313
#!/bin/sh
my_ip=`/sbin/ifconfig eth1 | grep 'inet addr' | awk '{print substr($2, index($2, ":")+1)}'`
recv=""
msg="not_existing, restart ..."
MONITOR_LOG="monitor.log"
#monitor procname scriptname...
分类:
系统相关 时间:
2014-10-11 23:25:07
阅读次数:
329
打开终端第一步:cat > count第二步:wc s.sh (s.sh是之前编好的文件)以Ctrl + D结束输出第三步:chmod +x count第四步:./count
分类:
系统相关 时间:
2014-10-11 22:18:46
阅读次数:
213
bash是linux默认命令行管理程序shell,汉澳 sinox也安装有,虽然sinox并没有默认使用bash,但是用户一旦使用就会可能被通过漏洞入侵,所以必须快速修复。虽然sinox使用freebsd 的ports,但是freebsd已经升级到最新的软件管理pkg,ports正在被淘汰,要通过portsnap直接更新到最新的ports然后用pkg安装,不过最新的ports只是在freebsd1...
分类:
系统相关 时间:
2014-10-11 22:17:57
阅读次数:
337
脚本代码: 新建文件back_db.sh #!/bin/bash TODAYTIME="`date +%Y%m%d`" DBNAME="test mysql" DUMPPATH="/usr/local/webserver/mysql/bin/mysqldump" HOST="xxx" USER="x...
分类:
数据库 时间:
2014-10-11 20:33:46
阅读次数:
165