User Tools

Site Tools


opus:fall2012:cgaines:unixpart2

unix Keyword 2

variables (environment/local)

Definition

Environment variable - within the shell, a variable that is stored in the environment. Because the environment is inherited by all child processes, environment variables can be thought of as global variables. However, they are not strictly global, because changes made by the child are not propagated back to the parent. Local Variable - A variable that exists only within the scope in which it was created. For example. within the shell, a variable that is not part of the environment is a local variable.

References

  • Harley Hahn's Guide to Unix and Linux
  • Programming Logic and Design
  • Wikipedia

unix Keyword 2 Phase 2

wildcards

Definition

wildcards are used in unix and other operating systems when searching for files or directory’s. some of the most common wildcards are the * and ?. The asterisk is used to represent any number of unknown characters. For example if you typed in file* you may receive a number of files beginning with file… file1.txt, file2.txt, fileboy.txt, fileoctopus.txt. Note that the .txt has nothing to do with it it is just a file name extension. The ? make on the other hand only represents one unknown character so if you typed in file? you will only receive file names such as file.txt, file1.txt, file2.txt but now files with more than one extra character after the name file.

References

Demonstration

Using wildcards to count how many files or directory with certain characters:

lab46:~$ ls ??? | wc -l
2
lab46:~$ ls ??* | wc -l
83
lab46:~$ ls -d *[aeiou] | wc -w
2 
opus/fall2012/cgaines/unixpart2.txt · Last modified: 2012/11/02 19:06 by cgaines