Скачать презентацию
Идет загрузка презентации. Пожалуйста, подождите
Презентация была опубликована 9 лет назад пользователемТатьяна Кавелина
1 Week - 2 1
2 Configuring the Bash Shell 2
3 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
4 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
5 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
6 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
7 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
8 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
9 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
10 Bash startup tasks:bashrc Stored in /etc/bashrc(global) and ~/.bashrc(user) Run for all shells Used for Setting local variables Defining aliases 10
11 Sourcing files Changes to profile and bashrcfiles need to be sourced Two methods:. Source Shell scripts can source other files:.~/.bashrc 11
12 Bash exit tasks Stored in ~/.bash_logout(user) Run when a login shell exits Used for Creating automatic backups Cleaning out temporary files 12
Еще похожие презентации в нашем архиве:
© 2024 MyShared Inc.
All rights reserved.