Solaris default shell Modification

Source: Internet
Author: User

 

Solaris is used in many aspects, which is not the same as before. The following describes some shell Problems and Solutions in Solaris.

The default shell of Solaris is sh, that is, the command line prompt is (Root User ):#

In the Linux Command Line prompt, there are user names, host names, and the name of the current path. This will give people a clear impression. However, in Linux, the default shell is Bash, not Sh. If you only want to switch the shell in the current use, the method is very simple. You can enter the following in the command line:

$ Bash

Bash-3.00 $ CSH

David % sh

$


If you want to permanently change the default shell, you need to modify the/etc/passwd file. When passwd is enabled, the first line records the relevant information of the root user. The content of this line is:
Root: X: 0: 0: super-user: // sbin/SH

Here, the last colon is followed by the default shell of the root user. We will change it to the bash path:
Root: X: 0: 0: super-user: // usr/bin/bash

 

 

Of course, we can also use stty to modify it. For details, refer to blog:

Stty command

Http://blog.csdn.net/tianlesoftware/archive/2010/03/15/5381984.aspx

 

Description of Shell and shell script:

DOS command. com is a shell that is responsible for interpreting your commands and executing them. Similarly
This is also available on Unix. It is automatically started by the system after you successfully log in.
There are many shell, sh, CSH, KSh, tcsh, bash and so on Unix. Generally, CSH and login shell can be changed using the ypchsh command, but you must first know that the new shell you want to change is under that directory. Tcsh has functions similar to doskey.

DOS contains so-called batch files to facilitate some routine work. UNIX also has batch processing, which is called shell script, which is much stronger than DOS batch files. It is written in almost a high-level language. Shell script is a text file, but its position is exactly the same as that of other commands or executable files. You only need to use the CHMOD command to set the shell script access permission to executable. The. login file under the $ home directory is a typical shell script, similar to DoS autoexec. bat.

Save the file passwd and exit.

In this way, you can use the tab key to complete the input of the command line and the up and down arrows to play back the history of the input command, but sh does not have this function. However, this modification alone does not enable the command line prompt to show that there are both user names and host names and the current path name in the Linux prompt.

You need to edit another file. Create a file. profile under $ home. If the file exists, add content to it. Because it is a root user, the $ home path is the root directory /. Create a file. profile in the root directory and add the following content to it:

PS1 = '[/u @/h: $ PWD] #'
Export PS1

Save and exit the file and restart the system. After entering the system, open a terminal and the command line prompt is:

[Root @ Solaris:/] #

Run the following command:
[Root @ Solaris:/] # echo $ shell // view the default shell of the system
/Usr/bin/bash

Run the following command:
[Root @ Solaris:/] # cd home

The command line is changed:
[Root @ Solaris:/Home] #

Root indicates the user name, Solaris indicates the host name, And/home indicates the current path.

Of course, if you are used to CSH, you can switch the shell to CSH first. Then, enter the following command:
# Set filec

In this way, you can complete the command line in CSH. However, the complete input uses the ESC key instead of the tab key.

 

When writing a shell script, we must add "#!" to the first line. /Bin/KSh ". This indicates the program to be used to execute the rows in the script.


Note: organize from Network

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.