Computer Services & Repairs
Chicago and Suburbs
 

Table of Contents

 

7.02 User Created Variables

Examples: Of user Created Variables with a quick explaining

[bash]$ person=chris # creates variable person with a parameter chris

[bash]$ echo $person # display parameter of variable person

[bash]$ chris

[bash]$ echo '$person' # by quoting the parameter with single quotation marks prevents shell $person from substituting the value of a variable

[bash]$ echo \$person # by placing backslash (\) in the beginning of the variable prevents shell $person from substituting the value of a variable

[bash]$ people=”chris and karolina” # creates a variable with a parameter 'chris and karolina' (use double quotation marks when space or tab need to be used in a $ chris and karolina parameter)

[bash]$ ls chris* # section 5.04 Wildcards

[bash]$ chris.doc chris.sum # by executing ls* prompt show two files chris.doc and chris.sum (these files are just samples)

[bash]$ memos=chris* # assigning value to a variable, shell process a command line i a specific order

[bash]$ echo $memos # shell expands $memos to chris*

[bash]$ chris.doc chris.sum # shell expands chris* to chris.doc and chris.sum, and passes these values to echo

[bash]$ FIRST=Chris

[bash]$ SECOND=Siedlecki

[bash]$ FIRSTANDLAST=”First name: ${FIRST} Lastname: ${SECOND}”

[bash]$ echo $FIRSANDLAST

[bash]$ First name: Chris Lastname: Siedlecki

 
 
   

Copyright 2006 © Burnnet Computers LLC.