Shell Scripting: How to Automate Command Line Tasks Using Bash Scripting and Shell Programming by Cannon Jason
Author:Cannon, Jason [Cannon, Jason]
Language: eng
Format: epub, pdf
Published: 2015-09-13T16:00:00+00:00
cd /var/www
cp *.html /var/www-just-html
Let's say you want to do something for each file that matches a wildcard. In that case, you can use a for loop. Let's use a for loop to perform an action on all the html files in a directory.
The following script simply echoes to the screen the name of the file that is about to be copied, and then copies that file from the /var/www directory to the /var/www-just-html directory. Of course, you could do something more complex in this loop if you wanted.
Notice that the wildcard expression is being used where you would normally provide a list. This wildcard expression will expand to create a list of matching file and directories. In the case that the wildcard is not matched, the for loop is not executed. Also notice that we are explicitly changing into a directory before we use the wildcard.
#!/bin/bash
Download
Shell Scripting: How to Automate Command Line Tasks Using Bash Scripting and Shell Programming by Cannon Jason.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
API Testing and Development with Postman by Dave Westerveld(3619)
Learning C# by Developing Games with Unity 2020 by Harrison Ferrone(2616)
Software Architecture for Busy Developers by Stéphane Eyskens(2323)
2021 Beginners Guide to Python Programming Language: A Crash Course to Mastering Python in One Hour by Elmer Gary & Elmer Gary(1884)
Machine Learning for Algorithmic Trading by Stefan Jansen(1629)
Hands-On ROS for Robotics Programming by Bernardo Ronquillo Japón(1572)
Delphi GUI Programming with FireMonkey by Andrea Magni(1457)
Game Development Projects with Unreal Engine by Hammad Fozi & Goncalo Marques & David Pereira & Devin Sherry(1402)
Cloud Native with Kubernetes by Alexander Raul(1374)
Datadog Cloud Monitoring Quick Start Guide by Thomas Kurian Theakanath(1347)
Software Architecture Patterns for Serverless Systems by John Gilbert(1338)
Practical Node-RED Programming by Taiji Hagino(1336)
Automate It with Zapier by Kelly Goss(1318)
Practical System Programming for Rust Developers by Prabhu Eshwarla(1312)
Delphi Programming Projects by William Duarte(1296)
Mastering React Test-Driven Development by Daniel Irvine(1290)
Developing Multi-Platform Apps with Visual Studio Code by Ovais Mehboob Ahmed Khan & Khusro Habib & Chris Dias(1253)
Ghidra Software Reverse Engineering for Beginners by A. P. David(1244)
Learn Spring for Android Application Development by S. M. Mohi Us Sunnat(1235)
