⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch21.txt

📁 平时学习linux总结的命令
💻 TXT
字号:
Chapter 21

-------------------------
Overriding Default Values
-------------------------
#!/bin/bash
if [ "$#" -eq 2 ]
   then
     mail -s $1 bob@mycomputer mary@mycomputer < $2
   elif [ "$#" -eq 3 ]
    then
     mail -s $1 $3 < $2
    else
       echo "You did not enter the correct number of arguments."
fi

----------------------------
Using Switches to Set Values
----------------------------
#!/bin/bash
if [ "$#" -eq 4 ]
   then
     if [ "$1" -= "-s" ]
        then
          declare subject="$2"
     fi
     if [ "$3" -= "-f" ]
        then
           declare file="$4"
     fi
     if [ "$1" -= "-f" ]
        then
           declare file="$2"
     fi
     if [ "$3" -= "-s" ]
        then
          declare subject="$4"
     fi
     mail -s $subject bob@mycomputer mary@mycomputer < $file
else
     echo "You did not enter the correct number of arguments."
fi

------------------------------------
Sending Multiple Emails Using a Loop
------------------------------------
#!/bin/bash
for friends in bob@mycomputer mary@mycomputer tom@mycomputer 
   do
       mail -s $1 $friends < $2
done

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -