{"id":6411,"date":"2022-12-20T18:58:19","date_gmt":"2022-12-20T21:58:19","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/set-mann\/"},"modified":"2022-12-20T18:58:19","modified_gmt":"2022-12-20T21:58:19","slug":"set-mann","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/set-mann\/","title":{"rendered":"set (mann)"},"content":{"rendered":"<h1 align=\"center\">set<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#EXAMPLES\">EXAMPLES<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#KEYWORDS\">KEYWORDS<\/a> <\/p>\n<hr>\n<p>______________________________________________________________________________<\/p>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">set \u2212 Read and write variables<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>set<\/b> <i>varName<\/i> ?<i>value<\/i>? ______________________________________________________________________________<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Returns the value of variable <i>varName<\/i>. If <i>value<\/i> is specified, then set the value of <i>varName<\/i> to <i>value<\/i>, creating a new variable if one does not already exist, and return its value. If <i>varName<\/i> contains an open parenthesis and ends with a close parenthesis, then it refers to an array element: the characters before the first open parenthesis are the name of the array, and the characters between the parentheses are the index within the array. Otherwise <i>varName<\/i> refers to a scalar variable.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">If <i>varName<\/i> includes namespace qualifiers (in the array name if it refers to an array element), or if <i>varName<\/i> is unqualified (does not include the names of any containing namespaces) but no procedure is active, <i>varName<\/i> refers to a namespace variable resolved according to the rules described under <b>NAME RESOLUTION<\/b> in the <b>namespace<\/b> manual page.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">If a procedure is active and <i>varName<\/i> is unqualified, then <i>varName<\/i> refers to a parameter or local variable of the procedure, unless <i>varName<\/i> was declared to resolve differently through one of the <b>global<\/b>, <b>variable<\/b> or <b>upvar<\/b> commands.<\/p>\n<h2>EXAMPLES <a name=\"EXAMPLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Store a random number in the variable <i>r<\/i>:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\"><b>set<\/b> r [expr {rand()}]<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Store a short message in an array element:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\"><b>set<\/b> anAry(msg) &#8220;Hello, World!&#8221;<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Store a short message in an array element specified by a variable:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\"><b>set<\/b> elemName &#8220;msg&#8221; <b><br \/> set<\/b> anAry($elemName) &#8220;Hello, World!&#8221;<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Copy a value into the variable <i>out<\/i> from a variable whose name is stored in the <i>vbl<\/i> (note that it is often easier to use arrays in practice instead of doing double-dereferencing):<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\"><b>set<\/b> in0 &#8220;small random&#8221; <b><br \/> set<\/b> in1 &#8220;large random&#8221; <b><br \/> set<\/b> vbl in[expr {rand() >= 0.5}] <b><br \/> set<\/b> out [<b>set<\/b> $vbl]<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">expr(n), global(n), namespace(n), proc(n), trace(n), unset(n), upvar(n), variable(n)<\/p>\n<h2>KEYWORDS <a name=\"KEYWORDS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">read, write, variable<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  set \u2212 Read and write variables <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3783,1],"tags":[2635,2611],"class_list":["post-6411","post","type-post","status-publish","format-standard","hentry","category-n-comandos-tcl-tk","category-sin-categoria","tag-mann","tag-set"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6411","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=6411"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6411\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6411"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}