1. Trang chủ
  2. » Giáo Dục - Đào Tạo

040 wildcards in scripts kho tài liệu training

10 59 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 73,84 KB

Nội dung

Wildcards in Shell Scripts LinuxTrainingAcademy.com What You Will Learn ● How to use wildcards in your shell scripts LinuxTrainingAcademy.com Why use wildcards? ● Wildcards are great when you want to work on a group of files or directories LinuxTrainingAcademy.com Just like a regular command line #!/bin/bash cd /var/www cp *.html /var/www-just-html LinuxTrainingAcademy.com In a for loop #!/bin/bash cd /var/www for FILE in *.html echo "Copying $FILE" cp $FILE /var/www-just-html done LinuxTrainingAcademy.com Output: Copying about.html Copying contact.html Copying index.html LinuxTrainingAcademy.com In a for loop #!/bin/bash for FILE in /var/www/*.html echo "Copying $FILE" cp $FILE /var/www-just-html done LinuxTrainingAcademy.com Output: Copying /var/www/about.html Copying /var/www/contact.html Copying /var/www/index.html LinuxTrainingAcademy.com In a for loop #!/bin/bash for FILE in *.html echo "Copying $FILE" cp $FILE /var/www-just-html done LinuxTrainingAcademy.com Summary ● ● Just like on the command line In a loop LinuxTrainingAcademy.com ... done LinuxTrainingAcademy.com Output: Copying about.html Copying contact.html Copying index.html LinuxTrainingAcademy.com In a for loop #!/bin/bash for FILE in /var/www/*.html echo "Copying $FILE"... done LinuxTrainingAcademy.com Output: Copying /var/www/about.html Copying /var/www/contact.html Copying /var/www/index.html LinuxTrainingAcademy.com In a for loop #!/bin/bash for FILE in *.html... ● How to use wildcards in your shell scripts LinuxTrainingAcademy.com Why use wildcards? ● Wildcards are great when you want to work on a group of files or directories LinuxTrainingAcademy.com

Ngày đăng: 17/11/2019, 08:18

w