2018/03/05

March 05 2018 Monday

Weather:little rain to cloudy
1、需求:编写一个名为chname的程序,将当前目录下所有的.txt文件更名为.doc文件。
2、需求:编写一个名为chuser的程序,执行中每隔5分钟检查指定的用户是否登录系统,用户名从命令行输入;如果指定的用户已经登录,则显示相关信息。

[root@Dasoncheng sbin]# cat chname.sh 
#!/bin/bash
##Changing the name of file likes .txt to .doc!
for i in `find . -maxdepth 1 -name "*.txt" -type f `;
do
  i2=`echo $i |awk -F '.txt' '{print $1}'`
  mv $i $i2.doc
done 
[root@Dasoncheng sbin]# cat o.sh 
#!/bin/bash
##2.Test the user who i read whether is online every five miniutes !
read -p "Please input a username !" n
while :
do
  if `who |grep -w $n &>/dev/null`;
  then
      echo "The user $n is online !"
  else
      echo "Sorry , the user $n is offline !"
  fi
  sleep 300
done
answer referred
1
#!/bin/bash
find . -type f -name "*.txt" > /tmp/txt.list
for f in `cat /tmp/txt.list`
do
    n=`echo $f|sed -r 's/(.*)\.txt/\1/'`
    echo "mv $f $n.doc"
done

2 
#!/bin/bash
read -p "Please input the username: " user
while :
do
    if who | grep -qw $user
    then
        echo $user login.
    else
        echo $user not login.
    fi
    sleep 300
done

转载于:https://my.oschina.net/u/3651233/blog/1629732

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>音乐相册</title> <style> @import url("CSS/ring.css"); @import url("CSS/square.css"); /* 定义动画 */ @keyframes box-ani{ /* 开始动画 */ from{ transform: rotateX(-15deg) rotateY(10deg); } /* 结束动画 */ to{ transform: rotateX(-15deg) rotateY(370deg); } } /* 使用动画 */ .box{ animation-name: box-ani; animation-duration: 10s; animation-iteration-count: infinite; animation-timing-function: linear; } </style> </head> <body> <div class="btn-box"> <button class="btn">环形</button> <button class="btn-square">正方体</button> </div> <div class="box square"> <img src="img/w01.jpg" alt=""/> <img src="img/w02.jpg" alt=""/> <img src="img/w03.jpg" alt=""/> <img src="img/w04.jpg" alt=""/> <img src="img/w05.jpg" alt=""/> <img src="img/w06.jpg" alt=""/> <img src="img/w07.jpg" alt=""/> <img src="img/2014.jpg" alt=""/> <img src="img/2015.jpg" alt=""/> <img src="img/2016.jpg" alt=""/> <img src="img/2017.jpg" alt=""/> <img src="img/2018上.jpg" alt=""/> </div> </body> <script> var btn =document.querySelector(".btn"); var box =document.querySelector(".box"); var btnSquare=document.querySelector(".btn-square") btn.onclick =function(){ // 现在点击以后要在box的盒子上面添加一个class 为ring的样式 box.classList.remove("square"); box.classList.add("ring"); } btnSquare.onclick =function(){ box.classList.remove("ring"); box.classList.add("square"); } </script> </html>帮我写一个可以添加背景音乐的代码
最新发布
06-09
可以在 body 标签中添加以下代码来实现添加背景音乐的功能: ```html <audio src="音乐文件的路径" autoplay loop></audio> ``` 其中,src 属性指定音乐文件的路径,autoplay 属性设置为自动播放,loop 属性设置为循环播放。例如,如果将音乐文件命名为 music.mp3,并放在项目的根目录下,可以将代码改为: ```html <audio src="music.mp3" autoplay loop></audio> ``` 将该代码添加到 body 标签的末尾即可。完整代码如下: ```html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>音乐相册</title> <style> @import url("CSS/ring.css"); @import url("CSS/square.css"); /* 定义动画 */ @keyframes box-ani{ /* 开始动画 */ from{ transform: rotateX(-15deg) rotateY(10deg); } /* 结束动画 */ to{ transform: rotateX(-15deg) rotateY(370deg); } } /* 使用动画 */ .box{ animation-name: box-ani; animation-duration: 10s; animation-iteration-count: infinite; animation-timing-function: linear; } </style> </head> <body> <audio src="music.mp3" autoplay loop></audio> <div class="btn-box"> <button class="btn">环形</button> <button class="btn-square">正方体</button> </div> <div class="box square"> <img src="img/w01.jpg" alt=""/> <img src="img/w02.jpg" alt=""/> <img src="img/w03.jpg" alt=""/> <img src="img/w04.jpg" alt=""/> <img src="img/w05.jpg" alt=""/> <img src="img/w06.jpg" alt=""/> <img src="img/w07.jpg" alt=""/> <img src="img/2014.jpg" alt=""/> <img src="img/2015.jpg" alt=""/> <img src="img/2016.jpg" alt=""/> <img src="img/2017.jpg" alt=""/> <img src="img/2018上.jpg" alt=""/> </div> <script> var btn =document.querySelector(".btn"); var box =document.querySelector(".box"); var btnSquare=document.querySelector(".btn-square") btn.onclick =function(){ // 现在点击以后要在box的盒子上面添加一个class 为ring的样式 box.classList.remove("square"); box.classList.add("ring"); } btnSquare.onclick =function(){ box.classList.remove("ring"); box.classList.add("square"); } </script> </body> </html> ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值