TCSH shell variables and feature configurations

Source: Internet
Author: User

Tcshshell enables users to configure their own shells with shell configuration variables and features. You can also set the characteristics by using the SET command. TCSH also has registration, and when and when to enter Tcshshell configuration file.

First, TCSH shell features

TCSH has several features that allow you to control the methods of different shell operations. TCSH shell features include not only many of its own features, but also features in the Ksh/bash shell, such as a noclobber in TCSH that prevents redirection of rewriting files, and some of the more commonly used features are: Echo,noclobber, Ignoreeof and Noglob. Turn on/off the TCSH shell feature and name the variable for each feature by defining and cancelling the variables associated with the attribute.

For example, by defining the Noclobber variable, open the Noclobber feature. Define variables using the SET command, and use the unset command to cancel the definition of a variable. To run the Noclobber feature, use Set Noclobber, to close it, use the unset Noclobber. For example:

set variable 定义变量
unset variable 取消变量

Because these variables are often used to turn on/off features, they are sometimes called dual-state switching.

1, Echo

Sets the characteristics of the Echo start display command before Echo is executed;

set echo 打开echo特征
unset echo 关闭echo特征

2, Ignoreeof

Set ignoreeof start to prevent users from using ctrl+d to eliminate the characteristics of the user shell, it is used to prevent sudden injection of the operation, if this feature is closed, you can use CTRL+D injection process. Because Ctrl+d is the end user input in standard input, Therefore, it is very easy to cause sudden injection of the shell process. Thus, ignoreeof features can prevent this sudden injection, when this feature is set, the user must use the logout command explicitly.

3, Noclobber

Set Noclobber to start to prevent existing files from being redirected to output with this feature, if the output is redirected to a file that already exists, the file is not overwritten with the standard output. The original file is saved. This may happen: the existing file name is used as the filename to hold the redirected input. The Noclobber feature allows users to not accidentally rewrite the original file.

%set noclobber
%cat oldfile > newfile
newfile: file exist

Sometimes, when a user wants to rewrite a file with redirected output, an exclamation point is placed after the redirection symbol operator! Implements the override operation. This overrides the Noclobber feature and replaces the file contents with standard output.

%cat oldfile >!newfile

4, Noglob

Set Noglob to make a feature valid, which prohibits certain characters in the user's shell. Character *? [] ~ will no longer extend to a matching filename. For example:

%set noglob
%ls myfile?*
myfile?*

5, Appendix: Commonly used TCSH shell features;

特征 功能
set 打开shell特征
unset 关闭shell特征
echo 执行命令前显示该命令
ignoreeof 禁止用CTRL+D注消
noclobber 不必通过重新定向重写文件
noglob 禁止特殊字符用于文件名扩展:* ? ~ [ ]
notify 当完成后台任务时立即通知用户
verbose 历史命令引用后显示命令

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.