Filename $ {fileuser:-& quot; filename & quot;} -- Linux general technology-Linux technology and application information. Read the following for details. #! /Bin/bash
# Program:
# User can keyin filename to touch 3 new files.
# History:
#2005/08/23 VBird First release
PATH =/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin :~ /Bin
Export PATH
#1. Ask the user to enter the file name and obtain the fileuser variable;
Echo-e "I will use 'touch' command to create 3 files ."
Read-p "Please input the filename what you want:" fileuser
#2. To prevent users from pressing Enter at will, does the variable function show whether the file name is set?
Filename =$ {fileuser:-"filename "}
#3. start to use the date command to obtain the required file name;
Date1 = 'date -- date = '2 days ago '+ % Y % m % d'
Date2 = 'date -- date = '1 days ago '+ % Y % m % d'
Date3 = 'date + % Y % m % d'
File1 = "$ filename" "$ date1"
File2 = "$ filename" "$ date2"
File3 = "$ filename" "$ date3"
#4. Create a file name!
Touch $ file1
Touch $ file2
Touch $ file3
Could you tell me the above:
#2. To prevent users from pressing Enter at will, does the variable function show whether the file name is set?
Filename =$ {fileuser:-"filename "}
Why ?????
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.