Tips to Use the Linux set command

Tips to Use the Linux set command

Hello Geeky, so today we are focusing on How to Use the Linux set command. So please read this tutorial carefully so you may comprehend it in a better helpful way.

Guide: How to Use the Linux set command

The Linux set command is a short shell command that allows you to define or set both shell and weather factors. In this guide, we cover the set up and define the different ways in which a command line application can be used.

Sintasi

Shell Bourn (sh):

set [–aefhkntuvx[argument]]…

C shell (csh):

set [var[=value]]

set var [n] = words

Shell Korn (ksh):

set [+-aefhkmnopstuvx] [+-o option]… [+-A name] [arg…]

Options: Bourne Shell (sh)

In sh, the built-in command is set in the following options:

– The dash-double option (“-“) indicates the end of an option menu. This option is useful first when the values ​​listed after the options start with the dash itself. -a Mark variable that is modified or created for “export”; the environment variables set up in this way will pass to the areas of any subsequent commands. -e Exit immediately if an order comes out with a non-zero exit mode. -f Delete file name generation (globbing). -h Find and remember job commands as defined functions (service commands are normal when the function is running). -k All keyword arguments are placed in the domain for a command, not just those that precede the command name. -n Read commands but do not execute them. -t Exit after a read and a command. -u Maintain unstructured variables as error when replacing. -v Print shell entry lines as they are read. -x Print their commands and arguments as they are.

Using + instead – cause these flags to be turned off. These flags can also be used on the petals of the shell itself. The current flag settings are in the $ – variable. The remaining arguments are position-based arguments and are divided, in order, into $ 1, $ 2, etc. If no arguments are given the value of all names are entered.

For each name, the default command will remove the corresponding variable or service value. Major variables PATH, PS1, PS2, MAILCHECK, and IF may not be sufficient.

With an export command, the names given are automatically exported to the area of ​​the following commands. If no arguments are given, the variable names marked for export during the current shell execution are listed. Service names not exported.

Options: C Shell (csh)

In csh, If there are no specific arguments, set the display values ​​of all shell variables. Multi-word values ​​appear as a parentheses list. With only var argument, set the empty value (void) to var variable. With arguments of form var = value, set the value of the decision to var, where the value is one of:

a Word word (or string spoken). (wordlist) A space-separated list of words closed in parentheses.

The values ​​are ordered and the file name is expanded before being assigned. Forms set var[n]= word replaces text n’th in multi-word value with text.

unset removes variables that match their name (using substitute file name) process. All variables are removed by “default *”; this is a very bad idea if you do not know what you are doing, although.

Options: K Shell (ksh) In ksh, the command set accepts the following options:

-A sleep assignment. Remove the variable name and add the values ​​repeatedly from the arg list. If + A is used, the variable name will not be released first. -a All subsequent defined variables are exported automatically. -e If an order has a non-zero exit mode, activate the ERR trap (if set), and exit. This mode is disabled while reading profiles. -f Delete file name generation (globbing). -h Each command becomes an alias tracked when first met. -k All conversion assignment arguments are placed in the domain for a command, not just those that precede the command name. -m Background functions work in a separate process group and one line presses at the end. The exit status of the background services is traffic in a final message. On systems with function control, this flag is automatically turned on for interaction shells. -n Read commands and check them for syntax errors, but do not execute them. Ignorance of great interaction.

o option The argument argument can be one of the following: allexport Same as -a. errexit Kanna bi -e. bgnice All background functions are run in low mode, which is the default mode. emacs Insert emacs-style into the editor line for typing command. emacs Put you in gmacs line editor for typing command. care The shell will not come out at the end of the file. Command output must be used. Koko Kanna bi -k. markdirs All directory names resulting from the file name generation were trailing “/” appended. next Same as -m. noclobber Prevents the “>” correction to cut existing files. Ask ” >> | to cut a file when it is turned on. noexec Kanna bi -n. noglob Same bi -f. nolog Do not save job descriptions in the history file. nounset Same bi -u. Same interest as -p. verbose Same as -v. trackall Same bi -h. vi Put you into the custom vi-in-line editor mode until you hit escape. This option argument puts you in control mode. We sent back the line. viraw Each character is processed as it is entered in vi mode. xtrace Kanna bi -x. If no option name is provided then the current option setting is entered. -p Disable the function of the $ HOME / .profile file and use the file / etc / suid_profile instead of the ENV file. This mode is turned on whenever the effective uid (user ID) does not match the real uid, or when the effective gid (group ID) does not match the real gid. Deleting this allows the effective uid and gid to be set to real uid and gid. -s Adjust the position lexicographically. -t Exit after a read and a command. -u Maintain unadjusted parameters as when replacing. -v Print shell entry lines as they are read. -x Print their commands and arguments as they are. – Stop -x and -v flags and check arguments for flags. – Do not change any of the flags; valid in $ 1 setting to value starting with -. If no arguments follow this banner, then the status parameters are not set.

  • Using + instead – cause these flags to be turned off. These flags can also be used on the petals of the shell. Current flag settings are $ -. Unless -A is specified, the remaining arguments are eternal conditions and we are assigned, initially, to “$ 1 $ 2…”. If no arguments are given, then the names and values ​​of all variables are typed on the standard output.
  • Variables given by the list of names are automatically excluded: their values ​​and characteristics are deleted. Reading variables alone may not be enough. If the -f banner is set, then the names refer to the job names. Unlock ERRNO, LINENO, MAILCHECK, OPTARG, OPTIND, RANDOM, SECONDS, TMOUT, and _ remove their special meaning even if they are selected later.
  • When using a shortage, the variables given by the list of names are also unallocated: their values ​​and characteristics are deleted. Reading variables alone may not be enough. If -f, flag is set, then names refer to function names. Unlock ERRNO, LINENO, MAILCHECK, OPTARG, OPTIND, RANDOM, SECONDS, TMOUT, and _ remove their special meaning even if they are selected later.
  • With an export command, the names given are automatically exported to the area of ​​the following commands. Ksh commands preceding one or two “*” characters (punctuation marks) are typically treated in the following ways:
  • Changes to assignment lists that precede the order are in effect when the order expires.
  • I / O guides are advanced after variable assignments.
  • Errors cause scripts containing them to be deleted.
  • Words, following the previous command ** which is in the format of the assignment, is expanded with the same rules as the variable assignment. Assignment means that tilde conversion is done after mark = mark and word division and file name generation is not performed.

Faq

Guide about How to Use the Linux set command


In this guide, we told you about the How to Use the Linux set command; please read all steps above so that you understand How to Use the Linux set command in case if you need any assistance from us, then contact us.

How this tutorial or guide assisting you?


So in this guide, we discuss the How to Use the Linux set command, which undoubtedly benefits you.



Final note

I hope you like the guide How to Use the Linux set command. In case if you have any queries regards this article/tutorial you may ask us. Also, please share your love by sharing this article with your friends and family.

Trickbugs: Get the latest Trick and Tips
Logo
Enable registration in settings - general