mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-03-18 01:00:54 +00:00
Update cheatsheets
This commit is contained in:
27
tldr/typeset
27
tldr/typeset
@@ -5,29 +5,8 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# typeset
|
||||
|
||||
> Declare variables and give them attributes.
|
||||
> More information: <https://www.gnu.org/software/bash/manual/bash.html#Bash-Builtins>.
|
||||
> This command is an alias of `declare`.
|
||||
|
||||
- Declare a string variable with the specified value:
|
||||
- View documentation for the original command:
|
||||
|
||||
`typeset {{variable}}="{{value}}"`
|
||||
|
||||
- Declare an integer variable with the specified value:
|
||||
|
||||
`typeset -i {{variable}}="{{value}}"`
|
||||
|
||||
- Declare an array variable with the specified value:
|
||||
|
||||
`typeset {{variable}}=({{item_a item_b item_c}})`
|
||||
|
||||
- Declare an associative array variable with the specified value:
|
||||
|
||||
`typeset -A {{variable}}=({{[key_a]=item_a [key_b]=item_b [key_c]=item_c}})`
|
||||
|
||||
- Declare a readonly variable with the specified value:
|
||||
|
||||
`typeset -r {{variable}}="{{value}}"`
|
||||
|
||||
- Declare a global variable within a function with the specified value:
|
||||
|
||||
`typeset -g {{variable}}="{{value}}"`
|
||||
`tldr declare`
|
||||
|
||||
Reference in New Issue
Block a user