User Tools

Site Tools


opus:fall2012:smeas:unixpart2

unix Keyword 2

pipes

Definition

In Unix, a pipe (or pipeline) is used to direct the flow of output from one command as input to another command. This can be used to connect two operations together on a single command line, instead of having to use multiple command line inputs to receive the same result.

In Unix systems, pipes are shown using a vertical bar symbol, |. This bar will take the output from the command on the left, and use it as the input for the command on the right.

An example of this would be:

who | grep $USER

This would execute the who command, and then use it as input to the grep command, which would parse who for all instances of your own username.

References

unix Keyword 2 Phase 2

escape character

Definition

An escape character is a character used to invoke an alternative interpretation of subsequent characters in a sequence. This is generally used when a character on it's own has a specific function.

An example of this (in bash) would be the * wildcard, which is used to expand a name. If a * is needed as a literal character (“*” as opposed to *), an escape character is needed to tell the * not to act as a wildcard. In bash, the escape character is a backslash. Typing \* would treat * as a character, instead of a wildcard.

References

Demonstration

For my demonstration, I'm going to create a few files using symbols which require escape characters, and then show how the escape characters must be used to access these files.

The files I created were named “$$$”, “***”, “???”, and “\\\”

Attempting to access these files by typing in just their names caused different things to happen for each file, based on what the purpose of that file's character was.

However, if the bash escape character (“\”) was used before each character in the files' names, they were treated as a regular character, instead of a special character.

(I also realized right after taking and uploading these screenshots, I made my demonstration in my Experiment 2 folder on accident. Whoopsie!)

opus/fall2012/smeas/unixpart2.txt · Last modified: 2012/10/30 20:11 by smeas