Xem mẫu
Lập trình shell
Ngô Văn Công
Overview
Gọi thực hiện lệnh trong Shell
Biến trong Shell
Câu lệnh alias
Tùy biến môi trường
Điều khiển công việc
Viết chương trình Shell
Invoking the Shell
bash [options] [arguments]
Bash related special files
/etc/profile – system initialization file
~/.bash_profile(.bashrc) - personal initialization
file
~/.bash_history - record commands history
Biến trong shell
Sử dụng trong lập trình shell và điều khiển môi
trường
Gán giá trị cho biến: variable_name=value
Truy cập vào giá trị của biến: $variable_name
$ foo="hello there"
$ echo $foo
hello there
export: export variables to the environment or
sub-shells
Environment Variables
HOME - your home directory
SHELL - executable program for the current
shell
PATH - paths to locate executable files
USER - your username
TERM - type of current terminal
DISPLAY - your X-Window display
PS1 - command prompt
nguon tai.lieu . vn