1.shell简介
一.Shell简介LINUX/BSD 系统分成3个重要部分:核心,shell,工具程序
#vim hello.sh
#!/bin/bash
#这是我们的第一个程序hello.sh
echo '哈喽!bash shell!'
#chmod +x hello.sh
运行:
# bash hello.sh
哈喽!bash shell!
#
clearlog.sh
#!/bin/bash
#这是我们的第一个有用的shell
cp /dev/null /var/log/messages
二.部署bash shell的环境
# echo $SHELL查看当前shell
/bin/bash
# ls -al /bin/sh
lrwxrwxrwx. 1 root root 4 11月 6 18:05 /bin/sh -> bash
# echo $BASH_VERSION 查看shell版本
4.1.2(1)-release
#
自行编译最新版本的bash
举例
#tarzxvfbash-3.2.48.tar.gz 这个不是最新版的只做掩饰
#cdbash-3.2.48
#./configure--prefix=/home/ols3
#make
#make tests
#./bash
#echo $BASH_VERSION
安装
#su –
#make install
#su –c ‘make install’ 这条命令系统会询问root密码,密码正确后会执行命令,执行完后会恢复到本身身份
切换使用新的bashshell
#su –
#vim /etc/shells
添加/usr/local/bin/bash
# chsh
Changing shell for root.
New shell :
页:
[1]