Interactive script : The variable content is determined by the user

read -p variable : Read value to variable

echo -e ${ variable }: Displays the value of the variable

Interactive script :

topic : Write a script , Allows users to enter firstname and lastname, Finally, it is displayed on the screen your full name is:


Execute script :

utilize date create file :

topic : Want to create three empty files , The file name is determined by user input , Assumed user income filename, And today's date is 2022-05-16, Then create a file filename_20220516,fileame_20220515,filename_20220514.

  Numerical operation :

topic : Enter two variables , Multiply the contents of two variables

  numerical calculation :

bc command :

 ( out of commission /)

  topic : adopt bc calculation pi


attach :
#!/bin/bash #Program: # This program shows'hello,world'on your screen
#History: #2022-05-15 first release
PAHT=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin #
export PATH echo -e "hello,world \a \n" exit 0

#!/bin/bash #Program: # User inputs his first name and last name.Program shows
his full name. #History: #2022-05-15 frist release # PATH= # export PATH read
-p "please input your first name:" firstname read -p "please input your last
name:" lastname echo -e "\nyour name is:${firstname},${lastname}" exit 0 ~ ~ ~

#program: # Program creates three files,which named by user input and date
command #History: #2022-05-16,first release #from bird linux make user
input file name,and get varible fileuser echo -e "i will use 'touch' command to
create 3 files"#to show message read -p "please input your filename": fileuser filename=${fileuser:-"filename"} command for filename needed
date1=$(date --date='2 days ago' +%Y%m%d) #date of two day ago date2=$(date
--date='1 day ago' +%Y%m%d) #date of one day ago date3=$(date +%Y%m%d) #date of
today #4.config file file1=${filename}${date1} file2=${filename}${date2}
file3=${filename}${date3} #5.touch file touch "${file1}" touch "${file2}" touch

#!bin/bash #program: # user inputs 2 integer numbers;program will cross these
two numbers #History: #2022-05-16 from bird linux,first release echo -e "you
should input 2 numbers,i will mult them! \n" read -p "first number: " first
read -p "second number:" second total=$((${first}*${second})) echo -e "\nthe
result of ${first}*${second} is==>${total}" ~ ~ ~ ~ ~ #!/bin/bash #program: #
user input a scale number to calculate pi number. #History: #2022-05-16, bird
liunx, first release echo -e "this program will calculate pi value\n" echo -e
"you should input a float number to calculate pi value\n" read -p "the scale
number (10-1000)?" checking num=${checking:-"10"} #judge if not input a number
echo -e "starting calcuate pi value,be patient" time echo "scale=${num};4*a(1)"
| bc -lq

©2019-2020 Toolsou All rights reserved,
【C++ Must see for entry 】C++ from 0 reach 1 Introductory programming axios Interceptor packaging and use Spring Boot Interview must ask : Automatic configuration principle VMware 16 install centos 7 Detailed tutorial C Language data structure - Sequence table delete duplicates V2.0.0 The 12th Blue Bridge Cup c++b Group personal problem solving On sending data from serial port single chip microcomputer to upper computer centos7 install RabbitMqjava Polymorphic array of opencv-python Fourier transform and inverse transform