Linux set Command
-- Learning is not just about technology, but also about dreams!
- Home
- HTML
- JavaScript
- CSS
- Vue
- React
- Python3
- Java
- C
- C++
- C#
- AI
- Go
- SQL
- Linux
- VS Code
- Bootstrap
- Git
- Local Bookmarks
Linux Tutorial
Linux Tutorial Linux Introduction Linux Installation Linux Cloud Server Install Linux with WSL Linux System Boot Process Linux System Directory Structure Linux Forgot Password Solutions Linux Remote Login Linux File Basic Attributes Linux File and Directory Management Linux User and User Group Management Linux Disk Management Linux vi/vim Linux yum Command Linux apt Command
Shell Tutorial
Shell Tutorial Shell Variables Shell Passing Arguments Shell Arrays Shell Operators Shell echo Command Shell printf Command Shell test Command Shell Process Control Shell Functions Shell Input/Output Redirection Shell File Inclusion
Linux Reference Manual
Linux Command Complete Reference Nginx Installation and Configuration MySQL Installation and Configuration Linux Quiz
Nginx Installation and Configuration
Deep Exploration
Network Services
Computer Science
Web Service
Development Tools
Web Design and Development
Programming
Software
Scripting Languages
Programming Languages
Scripting
Linux set Command
Linux Command Complete Reference
The Linux set command is used to configure the shell.
The set instruction can configure the execution behavior of the shell being used, allowing settings to be made according to different requirements.
Syntax
set [+-abCdefhHklmnpPtuvx]
Parameter Description:
-aMark modified variables for export to environment variables.-bMake terminated background jobs immediately report their execution status.-CPrevent output redirection from overwriting existing files.-dThe shell uses a hash table by default to remember used commands to speed up command execution. Use the -d parameter to disable this.-eExit the shell immediately if a command returns a non-zero value.-fDisable the use of wildcard characters (globbing).-hAutomatically record the location of functions.-HThe shell can use "!" plus <command number> to execute commands recorded in history.-kAll parameters given to a command are treated as environment variables for that command.-lRecord the variable names used in for loops.-mUse monitor mode.-nRead commands but do not actually execute them.-pEnable priority mode.-PAfter enabling the -P parameter, when executing commands, actual files or directories are used instead of symbolic links.-tExit the shell after executing the following command.-uDisplay an error message when an undefined variable is used during execution.-vDisplay the input values as they are read by the shell.-xDisplay the command and its parameters before executing each command.+<parameter>Cancel a parameter that was previously enabled by set.
Examples
Display environment variables
# set
BASH=/bin/bash
BASH_ARGC=()
BASH_ARGV=()
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=(="3" ="00" ="15" ="1" ="release" ="i386-redhat-linux-gnu")
BASH_VERSION='3.00.15(1)-release'
COLORS=/etc/DIR_COLORS.xterm
COLUMNS=99
DIRSTACK=()
EUID=0
GROUPS=()
G_BROKEN_FILENAMES=1
HISTFILE=/root/.bash_history
HISTFILESIZE=1000
HISTSIZE=1000
HOME=/root
HOSTNAME=hnlinux
HOSTTYPE=i386
IFS=$'
'
INPUTRC=/etc/inputrc
KDEDIR=/usr
LANG=zh_CN.GB2312
LESSOPEN='|/usr/bin/lesspipe.sh %s'
LINES=34
L
MAIL=/var/spool/mail/root
MAILCHECK=60
OLDPWD=/home/uptech
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:/opt/crosstools/gcc-3.4.6-glibc-2.3.6/bin
PIPESTATUS=(="2")
PPID=26005
PROMPT_COMMAND='echo -ne "
YouTip