User Tools

Site Tools


wiki:expansion

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

wiki:expansion [2016/08/02 14:47] (current)
Line 1: Line 1:
 +====== Command line expansion =====
 +
 +When you type a command the shell does a few things before executing the command. ​ Before we get to that we need a new command, called ''​echo''​ which simply prints its output to standard output:
 +
 +<code bash>
 +$ echo this is a test 
 +this is a test
 +</​code>​
 +
 +Now here's an interesting example that might get you scratching your heads:
 +<code bash>
 +$ echo *
 +copy_of_file.txt my_file.txt my_file2.txt subdirectory
 +</​code>​
 +
 +To understand what happened here, recall that ''​*''​ is a wildcard that will match any character, and so before applying the echo command, the wildcard was expanded to match any file name in your current directory.
 +
  
wiki/expansion.txt ยท Last modified: 2016/08/02 14:47 (external edit)