Hdel » History » Version 4
Per Amundsen, 01/04/2019 09:20 PM
1 | 1 | Per Amundsen | _Added in 1.9.0_ |
---|---|---|---|
2 | |||
3 | */hdel [-sw] <name> <item>* |
||
4 | |||
5 | Deletes an item from a hash table. |
||
6 | |||
7 | 4 | Per Amundsen | _See also [[/hsave]], [[/hload]], [[/hmake]], [[/hfree]], [[$hget]], [[$hfind]]._ |
8 | |||
9 | 1 | Per Amundsen | *Switches* |
10 | |||
11 | -s - Displays the result. |
||
12 | 3 | Per Amundsen | -w - Indicates item is a [[Scripting_Wildcards|wildcard]]. |
13 | 1 | Per Amundsen | |
14 | *Parameters* |
||
15 | |||
16 | <name> - The hashtable to delete from. |
||
17 | <item> - The hashtable item to delete. |
||
18 | |||
19 | *Example* |
||
20 | |||
21 | <pre> |
||
22 | alias example { |
||
23 | 2 | Per Amundsen | ; Create a hash table |
24 | 1 | Per Amundsen | /hadd -m example academic a |
25 | 2 | Per Amundsen | |
26 | ; Add some items to the hash table.. |
||
27 | 1 | Per Amundsen | /hadd example academy a |
28 | /hadd example accelerate a |
||
29 | /hadd example accelerator a |
||
30 | /hadd example accept a |
||
31 | /hadd example access a |
||
32 | /hadd example accident a |
||
33 | /hadd example because b |
||
34 | |||
35 | 2 | Per Amundsen | ; Print number of items. |
36 | //echo -a $hget(example, 0).item |
||
37 | 1 | Per Amundsen | |
38 | 2 | Per Amundsen | ; Remove everything matching wildcard 'a*'. |
39 | 1 | Per Amundsen | /hdel -w example a* |
40 | |||
41 | 2 | Per Amundsen | ; Print number of items. |
42 | //echo -a $hget(example, 0).item |
||
43 | 1 | Per Amundsen | |
44 | 2 | Per Amundsen | ; Free table. |
45 | 1 | Per Amundsen | /hfree example |
46 | } |
||
47 | </pre> |