
本文共 3756 字,大约阅读时间需要 12 分钟。
#BASH������������
Shell������������
Shell���Linux���������������������������������������������������������������������Linux������������Bash���Bourne Again SHell���������������������������Shell������������������������������������������������Bash���������������������������������launchguard-*-fish������-source-fish������
Bash���������������������
1. Bash���������������
-
������������
Bash���������1000������������������������history
������������������������������history -c
��������������������������� -
������������
������������������������������������������������������������������������alias h5='head -5'
���������������������������
unalias
������������������ -
������������������������������
Bash��������������������������������������������������� ���������ps aux | grep '3306'
������������������������������������
ps aux
������������������������3306������������������������grep '3306'
������������������������
echo "passewd" | passwd --stdin username
������������������������
>
���>>
������������������������> list.txt
������������������������>> list.txt
������������������
2. ���������������������������
-
������������
������&
���������������������������������������������firefox &
������������
jobs
���������������������fg n
������������������������������ -
���������������
;
���������������������������������
ls /tmp; ls /root; ls /home
&
������������������������������������������������������������������
make ; make install
||
���������������������������������������������������������
id yuxiang > /dev/null || echo "No such user"
3. Bash������������
���������������������������������������������������Bash���������������������������������
1. ������������
- ���������������������������������������
TEST=
- ������������������������
readonly NAME="���������" # ������������������������������
- ���������������
echo $NAME
2. ���������������������
- ������������������
declare NUMBER # ���������������������������
- ���������������������
typeset -r NUMBER # ���������������������
- ���������������
NUMBER=test
- ������
read
������������������read -p "������������������" SAY
���������
read -p "������������������" PASSWD
3. ���������������������
- ���������������������
set | grep SAY
- ���������������
unset SAY
������������������
Bash���������������������������������������������������������������������
- PATH������������������������������
- HOME������������������������������
- PS1���������������������
������������������������
- $���������������������$0���������������������$1-$9���������������������
$*
���$@
���������������������������$*
������������������������$@
���������������������������������$$
���������������ID���%?
������������������������
������������
Bash������������������������������������������������������������������������������
- ���������������
A[1]=11
- ������������������
arr_num=(1 2 3 4)
���������������
- ������������������
arr_string=���'aa' 'bb' 'cc'���
- ���������������������
echo ${#arr_num[*]} # ���������������
- ���������������
arr_num=���4 3 2 1)
������������
���Bash��������������������������������������������������������������������������� let
���$(( ))
���$(())
���������������:
���������
num=10echo $((num+=5)) # ������15
������������������ $(( ))
������������������������������������������������������������������������������������
������������������������ bc
���������������������������������������������������������
echo "scale=5; 3.1415926535 * 2" | bc # ������6.283185307
expr���bc������
- expr������������������������������������
x=10; expr $x + 5
- bc������������������������������������������������������������
������
Bash ��������������������������� Linux ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
发表评论
最新留言
关于作者
