1.shell Build Shell Programming environment

Source: Internet
Author: User

The first time to write a blog, add some nonsense, learning Linux for a period of time, with the study of the deep discovery of their lack of learning system, especially encountered some inexplicable problems, I only have a variety of Baidu, good luck can be resolved, when the difference is not resolved, even if the solution is not clear how to solve, For this purpose from the most grounded gas shell learning, in the library borrowed the "shell from the beginning to Mastery", and then began to study, but learn to learn and forget some, and then search books, books are sometimes not very convenient, so there is this blog (self-deprecating, perhaps one day my blog can be a book) This article can be reproduced casually but must be added to the source of connection

    • 1. View the system default shell

Input instructions:

Echo $SHELL

Execution Result:

Echo $SHELL/bin/bash
    • 2. The sh nature in some Linux versions is bash

Input instructions:

[Email protected] tmp]# ll/bin/sh

Execution Result:

[[email protected] tmp]# ll/bin/sh14   /bin/sh Bash
    • 3. View the shell version

Input instructions

Echo $BASH _version

Execution results

Echo $BASH _version 4.1. 2 (1)-release
    • 4. Install the latest version of Bash

4.1. Download the bash source code

wget http://ftp.gnu.org/gnu/bash/bash-4.3.30.tar.gz

4.2. Extracting Source code

tar xvzf bash-4.3. . tar. gz

4.3. Configuring the compilation Environment

[Email protected] tmp]# cd bash-4.3.  - [email protected] Bash-4.3. +] #./configure

4.4. Test compilation to determine success

[Email protected] bash-4.3.  -  Make

4.5. Compiling bash

[Email protected] bash-4.3.  - Make Install

By default, bash will be installed under/usr/local/bin/

4.6. To see if the installation was successful, first switch to the new version of Bash's installation directory

 [[email protected] Bash-]# cd/usr/local/bin/[[email protected] bin]# lltotal  39148 -rwxr-xr-x 1  root root 2529633  Dec 12  15 : 57   bash -r-xr-xr-x 1  root root Span style= "color: #800080;" >6806  Dec 12  15 : 57  Bashbug 
4.7. Switch to the new version of Bash to view the current version
[[email protected] bin]#./echo4.3.  - (3)-release

4.8. Using the new version of the shell

From the above command, the current bash version is 4.3.30. This indicates that the new version of Bash has been compiled and installed successfully. However, the new shell is not yet available to users. Because the user can only use the shell listed by the/etc/shells file for security reasons, the following command displays the contents of the file:

 more/etc//bin/sh/bin/bash/sbin/nologin/bin/tcsh/ Bin/csh

The output from the above shows that the user can use 5 shells, while the first 2 are bash.

In order to use the new version of the shell, we need to add a path configuration, the configuration method has several minutes, here is a way to modify the/etc/shells with VIM, modify the information as follows:

/bin/sh/bin/bash/sbin/nologin/bin/tcsh/bin/csh/usr/local/bin/ Bash

1.shell Build Shell Programming environment

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.