Skip to content

lrakai/bash-primer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bash-primer

A Lab to prime your skills in using the Linux/mac OSX command line (bash)

Final Environment

Getting Started

An Azure RM template is included in infrastructure/ to create the environment:

Using Azure PowerShell, do the following to provision the resources:

.\startup.ps1

Alternatively, you can perform a one-click deploy with the following button:

Following Along

  1. Assign the my_path variable a value of /home:

    my_path=/home
  2. Print the value stored in my_path:

    echo $my_path
  3. List the contents of /home using the my_path variable:

    ls $my_path
  4. Assign the value of / (root directory) to my_path:

    my_path=/
  5. List the contents of the directory stored in my_path:

    ls $my_path
  6. Type echo $ then press tab twice to list all the currently defined variables.

  7. Type y to confirm that you want to see all the possible completions:

    Some worth knowing are

    • $HOME: Home directory path
    • $HOSTNAME: Name of the Linux host/machine
    • $PATH: A list of paths that are separated by colons. Whenever you enter a command these paths are automatically searched to find the corresponding command binary to run. Without the $PATH variable, you would need to give complete paths instead of just the name of the command. For example, rather than /bin/ls, you can enter ls because /bin is in your $PATH.
    • $SHELL: Path to the shell binary of your current shell (/bin/bash in the case of this Lab)
    • $USER: Name of the logged in user
  8. Store the the date in a variable called current_date:

    current_date=$(date)
  9. Output the value of the current_date variable:

    echo $current_date

Tearing Down

When finished, remove the Azure resources with:

.\teardown.ps1

About

A Lab to prime your skills in using the Linux/mac OSX command line (BASH)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published