Week - 2 1 Configuring the Bash Shell 2 Environment Variables Bash variables are local to a single shell by default Set with VARIABLE= VALUE Environment.

Презентация:



Advertisements
Похожие презентации
Using Bash Shell. Command Line Shortcuts File Globbing Globbing is wildcard expansion: * - matches zero or more characters ? - matches any single character.
Advertisements

Copyright 2003 CCNA 2 Chapter 14 Managing Cisco IOS Software By Your Name.
Standard I/O and Pipes. Standard Input and Output Linux provides three I/O channels to Programs Standard input (STDIN) - keyboard by default Standard.
S15-1 PAT318, Section 15, March 2005 SECTION 15 MSC.PATRAN FILES.
Unit 2 Users Management. Users Every user is assigned a unique User ID number (UID) UID 0 identifies root User accounts normally start at UID 500 Users'
© 2006 Cisco Systems, Inc. All rights reserved. SND v Configuring a Cisco IOS Firewall Configuring a Cisco IOS Firewall with the Cisco SDM Wizard.
Page 1 Information Systems Infrastructure: Foundations and Trends Week 3 Lecture Write your answers to these 8 review questions 2. Name some of Googles.
© 2006 Cisco Systems, Inc. All rights reserved. MPLS v Complex MPLS VPNs Using Advanced VRF Import and Export Features.
© 2005 Cisco Systems, Inc. All rights reserved. BGP v Route Selection Using Attributes Setting BGP Local Preferences.
© 2005 Cisco Systems, Inc. All rights reserved. BGP v Route Selection Using Policy Controls Applying Route-Maps as BGP Filters.
Unit 3 Text Processing and System Configuration tools.
© 2009 Avaya Inc. All rights reserved.1 Chapter Two, Voic Pro Components Module Two – Actions, Variables & Conditions.
© 2005 Cisco Systems, Inc. All rights reserved. IPTX v Configuring Additional Cisco CallManager Express Features Configuring Cisco CallManager Express.
© 2006 Cisco Systems, Inc. All rights reserved. MPLS v MPLS VPN Implementation Configuring Small-Scale Routing Protocols Between PE and CE Routers.
Copyright 2003 CCNA 3 Chapter 7 Switch Configuration By Your Name.
© 2006 Cisco Systems, Inc. All rights reserved. SND v Securing the Perimeter Disabling Unused Cisco Router Network Services and Interfaces.
Browsing the Filesystem. Linux File Hierarchy Concepts Files and directories are organized into a single- rooted inverted tree structure Filesystem begins.
© 2005 Cisco Systems, Inc. All rights reserved. BGP v Route Selection Using Policy Controls Employing AS-Path Filters.
WiseImage Open Architecture Lessons Mission Impossible.
© 2005 Cisco Systems, Inc. All rights reserved.INTRO v Operating and Configuring Cisco IOS Devices Starting a Switch.
Транксрипт:

Week - 2 1

Configuring the Bash Shell 2

Environment Variables Bash variables are local to a single shell by default Set with VARIABLE= VALUE Environment variables are inherited by child shells Set with export VARIABLE=VALUE Accessed by some programs for configuration 3

Some Common Variables Configuration variables PS1:Appearance of the bash prompt PATH: Directories to look for executables in EDITOR: Default text editor HISTFILESIZE: Number of commands in bash history Information variables Home: Users home directory EUID: Users effective UID 4

Aliases Aliases let you create shortcuts to commands $alias dir=ls –laF Use alias by itself to see all set aliases Use alias followed by an alias name to see alias value $alias dir alias dir = ls – laF 5

How bash expands a command line 1. Split the line into words 2. Expand aliases 3. Expand curly-brace statements({}) 4. Expand tilde statements(~) 5. Expand variables($) and Command – substitution($() and ) 6. Split the lint into words again 7. Expand file globs(*,?,[abc],etc) 8. Prepare I/O redirections( ) 9. Run the command! 6

Preventing Expansion Backslash(\) makes the next character literal $echo your cost:\$5.00 Your cost:$5.00 Quoting prevents expansion Single quotes() inhibit all expansion Double quotes() inhibit all expansion, except: $(dollar sign)- variable expansion (back quotes)- command substitution \(backslash) –single character inhibition !(Exclamation point)- history substitution 7

Login vs non-login shells Startup is configured differently for login and non-login shells Login shells are: Any shell created at login(includes X login) Su- Non-login shells are: Su Graphical terminals Executed scripts Any other bash instances 8

Bash startup tasks:profile Stored in /etc/profile(global) and ~/.bash_profile(user) Run for login shells only Used for Setting environment variables Running commands(eg :mail-checker script) 9

Bash startup tasks:bashrc Stored in /etc/bashrc(global) and ~/.bashrc(user) Run for all shells Used for Setting local variables Defining aliases 10

Sourcing files Changes to profile and bashrcfiles need to be sourced Two methods:. Source Shell scripts can source other files:.~/.bashrc 11

Bash exit tasks Stored in ~/.bash_logout(user) Run when a login shell exits Used for Creating automatic backups Cleaning out temporary files 12