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

📄 ch5.txt

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

-------------------------------------
Read Characters from the Keyboard and
Save Them as a String Variable
-------------------------------------
#!/bin/bash
clear
echo " "
echo "Enter Your First Name: "
read FirstName 

--------------------------------------
Read a Numeric Value from the Keyboard
and Save It as a Numeric Variable
--------------------------------------
#!/bin/bash
clear
echo " "
echo "Enter Your Age: "
read age 

------------------------------------
Read Both Strings and Numeric Values
from the Keyboard
------------------------------------
#!/bin/bash
clear
echo " "
echo "Enter Your First Name: "
read FirstName 
echo "Enter Your Last Name: "
read LastName 
echo "Enter Your Age: "
read age 

-----------------------------------
Prompt for User Name and Personally
Greet The User
-----------------------------------
#!/bin/bash
clear
echo " "
echo "Enter Your First Name: "
read FirstName 
echo "Hello, $FirstName"

-----------------------------------------------
Store A String Value To Another String Variable
-----------------------------------------------
#!/bin/bash
clear

declare FirstName
declare Greeting
echo $Greeting= "Hello,"
echo " "
echo "Enter Your First Name: "
read FirstName
echo "$Greeting $FirstName"

-----------------------------
Displaying a Numeric Variable
-----------------------------
#!/bin/bash
clear
echo " "
echo "Enter Your Age: "
read age 
echo "$age"

---------------------------------------
Displaying Numeric and String Variables
---------------------------------------
#!/bin/bash
clear
echo " "
echo "Enter Your First Name: "
read FirstName 
echo "Enter Your Age: "
read age 
echo "$FirstName, $age really isn't that old."

---------------------
Saving Data to a File
---------------------
#!/bin/bash
clear
echo " "
echo "Enter Your First Name: "
read FirstName 
echo "Enter Your Last Name: "
read LastName 
echo "$FirstName $LastName" > employees.dat

------------------------
Appending Data to a File
------------------------
#!/bin/bash
clear
echo " "
echo "Enter Your First Name: "
read FirstName 
echo "Enter Your Last Name: "
read LastName 
echo "$FirstName $LastName" >> employees.dat

-----------------------------------
Displaying Data Contained in a File
-----------------------------------
#!/bin/bash
clear
echo "Employee Data"
echo " "
cat employees.dat

⌨️ 快捷键说明

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