Changes

Jump to: navigation, search

Tutorial12: Shell Scripting - Part 2

109 bytes added, 11:24, 27 October 2020
WHERE DO I GO FROM HERE?
===Additional Loop Statements===
 
'''Command Substitution:'''
[[Image:for-command-substitution.png|thumb|right|300px|Example of how a '''for loop with command substitution''' works.]]
<span style="font-family:courier;font-weight:bold">file $(ls)<br>mail -s "message" $(cat email-list.txt) < message.txt<br><br>
'''Using the for Loop with Command Substitution'''
Let’s issue the for loop with a list using command substitution.<br>In the example below, we will use command substitution to issue the ls command and<br>have that output (filenames) become arguments for the for loop.<br><br>
<span style="font-family:courier;font-weight:bold;">for x in $(ls)<br>do<br> &nbsp;&nbsp;&nbsp;echo “The item is: $x”<br>done</span><br><br>
'''While Loops:'''
[[Image:while-loop.png|thumb|right|170px|Example of how a '''while''' loop works.<br>(Image licensed under [https://creativecommons.org/licenses/by-sa/3.0/ cc])]]
Take care and good luck in your future endeavours,
<span style="font-size:1.3em; font-family:cursive">Murray Saul</span>
= LINUX PRACTICE QUESTIONS =
13,420
edits

Navigation menu