Changes

Jump to: navigation, search

Tutorial10: Shell Scripting - Part 1

666 bytes added, 2 March
Using Variables in Shell Scripts
Refer to the diagram to the right for examples using positional and special parameters.
 
 
'''Command Substitution:'''
 
[[Image:for-command-substitution.png|thumb|right|300px|Example of how a '''for loop with command substitution''' works.]]
<i>'''Command substitution''' is a facility that allows a command<br>to be run and its output to be pasted back on the command line as arguments to another command.</i><br>Reference: https://en.wikipedia.org/wiki/Command_substitution<br><br>
 
''Usage:''
 
<span style="font-family:courier"><b>command1 $(command2)</b><br>or<br><b>command1 `command2`</b></span><br><br>
 
''Examples:''
 
<span style="font-family:courier;font-weight:bold">file $(ls)<br>mail -s "message" $(cat email-list.txt) < message.txt<br><br>
===Using Control Flow Statements in Shell Scripts===
13,017
edits

Navigation menu