期中考试题2:BigInteger的部分实现
CSS样式库

期末考试的shell script题

Kavinyao posted @ Nov 26, 2011 09:23:39 AM in 学习心得 with tags linux shell script exam , 1722 阅读

要求:

  1. 当前用户在字符界面下
  2. 进入用户的主目录
  3. 显示菜单,让用户选择,包括:1. 启动vi 2. 启动X Window 3.检查主目录下是否有.conf结尾的文件,如果有则使用at在23:00进行后台备份

 

> #!/bin/bash
> #author: kavinyao@gmail.com
> 
> #user=`whoami`
> #if [ $user = "root" ]
> #then
> #    home_dir="/root"
> #else
> #    home_dir="/home/$user"
> #fi
> #
> #cd $home_dir
> 
> cd ~
> 
> goodChoice=false
> until $goodChoice
> do
>     echo "what do you want to do? (enter number)"
>     echo "1. start vi"
>     echo "2. start x windows"
>     echo "3. backup *.conf"
> 
>     read option
> 
>     case $option in
>     "1")
>         goodChoice=true
>         vi;;
>     "2")
>         goodChoice=true
>         startx;;
>     "3")
>         goodChoice=true
>         
>         if [ -e *.conf ]
>         then
>             #echo "tar cvf backup.tar $home_dir/*.conf &" > job
>             echo "tar cvf backup.tar $HOME/*.conf &" > job
>             at -f job 23:00 
>             echo "back up set successfully"
>         else
>             echo "no *.conf found, will not backup"
>         fi
>         ;;
>     *)
>         echo "bad choice, please try again"
>     esac
> done
  • 无匹配
cleaning services 说:
Sep 23, 2019 05:28:13 PM

The reason why do 98% in our customers suggest Neat & Internet to friends and family for their own cleaning providers? Because the cleaning groups are appropriately trained, the service we offer and focus on detail which makes us the best option. Neat & Net may be the only home cleaning support to focus on cleaning with regard to health. Maid providers in Dubai haven't been therefore clean or even healthy.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter