1 | // /**
|
---|
2 | //
|
---|
3 | // Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>
|
---|
4 | // Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
---|
5 | // This program and the accompanying materials
|
---|
6 | // are licensed and made available under the terms and conditions of the BSD License
|
---|
7 | // which accompanies this distribution. The full text of the license may be found at
|
---|
8 | // http://opensource.org/licenses/bsd-license.php
|
---|
9 | //
|
---|
10 | // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
---|
11 | // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
---|
12 | //
|
---|
13 | // Module Name:
|
---|
14 | //
|
---|
15 | // UefiShellLevel2CommandsLib.uni
|
---|
16 | //
|
---|
17 | // Abstract:
|
---|
18 | //
|
---|
19 | // String definitions for UEFI Shell 2.0 level 1 commands
|
---|
20 | //
|
---|
21 | //
|
---|
22 | // **/
|
---|
23 |
|
---|
24 | /=#
|
---|
25 |
|
---|
26 | #langdef en-US "english"
|
---|
27 |
|
---|
28 | #string STR_NO_SCRIPT #language en-US "%EError. %NThe command '%B%s%N' is incorrect outside of a script.\r\n"
|
---|
29 | #string STR_GEN_PROBLEM #language en-US "%EError. %NThe argument '%B%s%N' is incorrect.\r\n"
|
---|
30 | #string STR_GEN_PROBLEM_VAL #language en-US "%EError. %NThe argument '%B%s%N' has incorrect value.\r\n"
|
---|
31 | #string STR_GEN_PROBLEM_SCRIPT #language en-US "%EError. %NThe argument '%B%s%N' is incorrect. Line: %d\r\n"
|
---|
32 | #string STR_GEN_INV_VAR #language en-US "%EError. %NThe script's Indexvar '%B%s%N' is incorrect.\r\n"
|
---|
33 | #string STR_GEN_TOO_FEW #language en-US "%EError. %NToo few arguments specified.\r\n"
|
---|
34 | #string STR_GEN_TOO_MANY #language en-US "%EError. %NToo many arguments specified.\r\n"
|
---|
35 |
|
---|
36 | #string STR_TEXT_AFTER_THEN #language en-US "%EError. %NThen cannot be followed by anything.\r\n"
|
---|
37 | #string STR_SYNTAX_AFTER_BAD #language en-US "%EError. %NSyntax after %s incorrect.\r\n"
|
---|
38 | #string STR_SYNTAX_IN #language en-US "%EError. %NSyntax after analyzing %s.\r\n"
|
---|
39 | #string STR_SYNTAX_NO_MATCHING #language en-US "%EError. %NNo matching '%B%s%N' for '%B%s%N' statement found. Line: %d.\r\n"
|
---|
40 | #string STR_INVALID_BINOP #language en-US "%EError. Binary operator not found first in '%B%s%N'.\r\n"
|
---|
41 | #string STR_SYNTAX_STARTING #language en-US "%EError. %NSyntax after %s.\r\n"
|
---|
42 |
|
---|
43 | #string STR_STALL_FAILED #language en-US "%EError. %NBootService Stall() failed with %r.\r\n"
|
---|
44 |
|
---|
45 | #string STR_GET_HELP_EXIT #language en-US ""
|
---|
46 | ".TH exit 0 "exits the script or shell"\r\n"
|
---|
47 | ".SH NAME\r\n"
|
---|
48 | "Exits the UEFI Shell or the current script.\r\n"
|
---|
49 | ".SH SYNOPSIS\r\n"
|
---|
50 | " \r\n"
|
---|
51 | "EXIT [/b] [exit-code]\r\n"
|
---|
52 | ".SH OPTIONS\r\n"
|
---|
53 | " \r\n"
|
---|
54 | " /b - Indicates that only the current UEFI shell script should be\r\n"
|
---|
55 | " terminated. Ignored if not used within a script.\r\n"
|
---|
56 | " exit-code - If exiting a UEFI shell script, the value that will be placed\r\n"
|
---|
57 | " into the environment variable lasterror. If exiting an instance\r\n"
|
---|
58 | " of the UEFI shell, the value that will be returned to the\r\n"
|
---|
59 | " caller. If not specified, then 0 will be returned.\r\n"
|
---|
60 | ".SH DESCRIPTION\r\n"
|
---|
61 | " \r\n"
|
---|
62 | "NOTES:\r\n"
|
---|
63 | " 1. This command exits the UEFI Shell or, if /b is specified, the current\r\n"
|
---|
64 | " script.\r\n"
|
---|
65 | ".SH EXAMPLES\r\n"
|
---|
66 | " \r\n"
|
---|
67 | "EXAMPLES:\r\n"
|
---|
68 | " * To exit shell successfully:\r\n"
|
---|
69 | " Shell> exit\r\n"
|
---|
70 | " \r\n"
|
---|
71 | " * To exit the current UEFI shell script:\r\n"
|
---|
72 | " Shell> exit /b \r\n"
|
---|
73 | " \r\n"
|
---|
74 | " * To exit a UEFI shell script with exit-code value returned to the caller:\r\n"
|
---|
75 | " Shell> exit 0\r\n"
|
---|
76 | ".SH RETURNVALUES\r\n"
|
---|
77 | " \r\n"
|
---|
78 | "RETURN VALUES:\r\n"
|
---|
79 | " 0 Exited normally\r\n"
|
---|
80 | " exit-code The return value specified as an option.\r\n"
|
---|
81 |
|
---|
82 | #string STR_GET_HELP_FOR #language en-US ""
|
---|
83 | ".TH for 0 "starts a for loop"\r\n"
|
---|
84 | ".SH NAME\r\n"
|
---|
85 | "Starts a loop based on 'for' syntax.\r\n"
|
---|
86 | ".SH SYNOPSIS\r\n"
|
---|
87 | " \r\n"
|
---|
88 | "FOR %indexvar IN set\r\n"
|
---|
89 | " command [arguments]\r\n"
|
---|
90 | " [command [arguments]]\r\n"
|
---|
91 | " ...\r\n"
|
---|
92 | "ENDFOR\r\n"
|
---|
93 | " \r\n"
|
---|
94 | "FOR %indexvar RUN (start end [step])\r\n"
|
---|
95 | " command [arguments]\r\n"
|
---|
96 | " [command [arguments]]\r\n"
|
---|
97 | " ...\r\n"
|
---|
98 | "ENDFOR\r\n"
|
---|
99 | ".SH OPTIONS\r\n"
|
---|
100 | " \r\n"
|
---|
101 | " %indexvar - Variable name used to index a set\r\n"
|
---|
102 | " set - Set to be searched\r\n"
|
---|
103 | " command [arguments] - Command to be executed with optional arguments\r\n"
|
---|
104 | ".SH DESCRIPTION\r\n"
|
---|
105 | " \r\n"
|
---|
106 | "NOTES:\r\n"
|
---|
107 | " 1. The FOR command executes one or more commands for each item in a set of\r\n"
|
---|
108 | " items. The set may be text strings or filenames or a mixture of both,\r\n"
|
---|
109 | " separated by spaces (if not in a quotation).\r\n"
|
---|
110 | " 2. If the length of an element in the set is between 0 and 256, and if the\r\n"
|
---|
111 | " string contains wildcards, the string will be treated as a file name\r\n"
|
---|
112 | " containing wildcards, and be expanded before command is executed.\r\n"
|
---|
113 | " 3. If after expansion no such files are found, the literal string itself is\r\n"
|
---|
114 | " kept. %indexvar is any alphabet character from 'a' to 'z' or 'A' to 'Z',\r\n"
|
---|
115 | " and they are case sensitive. It should not be a digit (0-9) because\r\n"
|
---|
116 | " %digit will be interpreted as a positional argument on the command line\r\n"
|
---|
117 | " that launches the script. The namespace for index variables is separate\r\n"
|
---|
118 | " from that for environment variables, so if %indexvar has the same name as\r\n"
|
---|
119 | " an existing environment variable, the environment variable will remain\r\n"
|
---|
120 | " unchanged by the FOR loop.\r\n"
|
---|
121 | " 4. Each command is executed once for each item in the set, with any\r\n"
|
---|
122 | " occurrence of %indexvar in the command replacing with the current item.\r\n"
|
---|
123 | " In the second format of FOR ... ENDFOR statement, %indexvar will be\r\n"
|
---|
124 | " assigned a value from start to end with an interval of step. Start and\r\n"
|
---|
125 | " end can be any integer whose length is less than 7 digits excluding sign,\r\n"
|
---|
126 | " and it can also applied to step with one exception of zero. Step is\r\n"
|
---|
127 | " optional, if step is not specified it will be automatically determined by\r\n"
|
---|
128 | " following rule:\r\n"
|
---|
129 | " if start <= end then step = 1, otherwise step = -1.\r\n"
|
---|
130 | " start, end and step are divided by space.\r\n"
|
---|
131 | ".SH EXAMPLES\r\n"
|
---|
132 | " \r\n"
|
---|
133 | "EXAMPLES:\r\n"
|
---|
134 | " * Sample FOR loop - listing all .txt files:\r\n"
|
---|
135 | " echo -off\r\n"
|
---|
136 | " for %a in *.txt\r\n"
|
---|
137 | " echo %a exists\r\n"
|
---|
138 | " endfor\r\n"
|
---|
139 | " \r\n"
|
---|
140 | " # \r\n"
|
---|
141 | " # If in current directory, there are 2 files named file1.txt and file2.txt\r\n"
|
---|
142 | " # then the output of the sample script will be as shown below.\r\n"
|
---|
143 | " # \r\n"
|
---|
144 | " Sample1> echo -off\r\n"
|
---|
145 | " file1.txt exists\r\n"
|
---|
146 | " file2.txt exists\r\n"
|
---|
147 | " \r\n"
|
---|
148 | " * Theoretically it is legal for 2 nested FOR commands to use the same\r\n"
|
---|
149 | " alphabet letter as their index variable, for instance, a: \r\n"
|
---|
150 | " #\r\n"
|
---|
151 | " # Sample FOR loop from 1 to 3 with step 1\r\n"
|
---|
152 | " #\r\n"
|
---|
153 | " echo -off\r\n"
|
---|
154 | " for %a run (1 3)\r\n"
|
---|
155 | " echo %a\r\n"
|
---|
156 | " endfor\r\n"
|
---|
157 | " \r\n"
|
---|
158 | " #\r\n"
|
---|
159 | " # Sample FOR loop from 3 down to 1 with step -1\r\n"
|
---|
160 | " #\r\n"
|
---|
161 | " echo -off\r\n"
|
---|
162 | " for %a run (3 1 -1)\r\n"
|
---|
163 | " echo %a\r\n"
|
---|
164 | " endfor\r\n"
|
---|
165 | " \r\n"
|
---|
166 | " #\r\n"
|
---|
167 | " # Sample FOR loop - 2 nested for using same index variable\r\n"
|
---|
168 | " #\r\n"
|
---|
169 | " echo -off\r\n"
|
---|
170 | " for %a in value1 value2\r\n"
|
---|
171 | " for %a in value3 value4\r\n"
|
---|
172 | " echo %a\r\n"
|
---|
173 | " endfor\r\n"
|
---|
174 | " endfor\r\n"
|
---|
175 | " \r\n"
|
---|
176 | " Note: When processing first FOR and before seeing the ENDFOR, the index\r\n"
|
---|
177 | " variable %a has the value "value1", so in second FOR, the %a has\r\n"
|
---|
178 | " been already defined and it will be replaced with the current value\r\n"
|
---|
179 | " of %a. The string after substitution becomes FOR value1 in value3\r\n"
|
---|
180 | " value4, which is not a legal FOR command. Thus only when the value\r\n"
|
---|
181 | " of %a is also a single alphabet letter, the script will be executed\r\n"
|
---|
182 | " without error. If 2 independent FOR commands use the same index\r\n"
|
---|
183 | " variable, when the second FOR is encountered, the first FOR has\r\n"
|
---|
184 | " already freed the variable so there will be no problem in this case.\r\n"
|
---|
185 |
|
---|
186 | #string STR_GET_HELP_ENDFOR #language en-US ""
|
---|
187 | ".TH endfor 0 "ends a for loop"\r\n"
|
---|
188 | ".SH NAME\r\n"
|
---|
189 | "Ends a 'for' loop.\r\n"
|
---|
190 | ".SH SYNOPSIS\r\n"
|
---|
191 | "See 'for' for usage.\r\n"
|
---|
192 | ".SH EXAMPLES\r\n"
|
---|
193 | "See 'for' for examples.\r\n"
|
---|
194 |
|
---|
195 | #string STR_GET_HELP_GOTO #language en-US ""
|
---|
196 | ".TH goto 0 "moves to a label"\r\n"
|
---|
197 | ".SH NAME\r\n"
|
---|
198 | "Moves around the point of execution in a script.\r\n"
|
---|
199 | ".SH SYNOPSIS\r\n"
|
---|
200 | " \r\n"
|
---|
201 | "GOTO label\r\n"
|
---|
202 | ".SH OPTIONS\r\n"
|
---|
203 | " \r\n"
|
---|
204 | " label - Specifies a location in batch file\r\n"
|
---|
205 | ".SH DESCRIPTION\r\n"
|
---|
206 | " \r\n"
|
---|
207 | "NOTES:\r\n"
|
---|
208 | " 1. The GOTO command directs script file execution to the line in the script\r\n"
|
---|
209 | " file after the given label. The command is not supported from the\r\n"
|
---|
210 | " interactive shell.\r\n"
|
---|
211 | " 2. A label is a line beginning with a colon (:). It can appear either after\r\n"
|
---|
212 | " the GOTO command, or before the GOTO command. The search for label is\r\n"
|
---|
213 | " done forward in the script file, from the current file position. If the\r\n"
|
---|
214 | " end of the file is reached, the search resumes at the top of the file and\r\n"
|
---|
215 | " continues until label is found or the starting point is reached. If label\r\n"
|
---|
216 | " is not found, the script process terminates and an error message is\r\n"
|
---|
217 | " displayed. If a label is encountered but there is no GOTO command\r\n"
|
---|
218 | " executed, the label lines are ignored.\r\n"
|
---|
219 | " 3. Using GOTO command to jump into another for loop is not allowed,\r\n"
|
---|
220 | " but jumping into an if statement is legal.\r\n"
|
---|
221 | ".SH EXAMPLES\r\n"
|
---|
222 | " \r\n"
|
---|
223 | "EXAMPLES:\r\n"
|
---|
224 | " * This is a script:\r\n"
|
---|
225 | " goto Done\r\n"
|
---|
226 | " ...\r\n"
|
---|
227 | " :Done\r\n"
|
---|
228 | " cleanup.nsh\r\n"
|
---|
229 |
|
---|
230 | #string STR_GET_HELP_ENDIF #language en-US ""
|
---|
231 | ".TH endif 0 "ends an if block"\r\n"
|
---|
232 | ".SH NAME\r\n"
|
---|
233 | "Ends the block of a script controlled by an 'if' statement.\r\n"
|
---|
234 | ".SH SYNOPSIS\r\n"
|
---|
235 | "See 'if' for usage.\r\n"
|
---|
236 | ".SH EXAMPLES\r\n"
|
---|
237 | "See 'if' for examples.\r\n"
|
---|
238 |
|
---|
239 | #string STR_GET_HELP_IF #language en-US ""
|
---|
240 | ".TH if 0 "controls the execution of a block of a script"\r\n"
|
---|
241 | ".SH NAME\r\n"
|
---|
242 | "Executes commands in specified conditions.\r\n"
|
---|
243 | ".SH SYNOPSIS\r\n"
|
---|
244 | " \r\n"
|
---|
245 | "IF [NOT] EXIST filename THEN\r\n"
|
---|
246 | " command [arguments]\r\n"
|
---|
247 | " [command [arguments]]\r\n"
|
---|
248 | " ...\r\n"
|
---|
249 | "[ELSE\r\n"
|
---|
250 | " command [arguments]\r\n"
|
---|
251 | " [command [arguments]]\r\n"
|
---|
252 | " ...\r\n"
|
---|
253 | " ]\r\n"
|
---|
254 | "ENDIF\r\n"
|
---|
255 | " \r\n"
|
---|
256 | "IF [/i] [NOT] string1 == string2 THEN\r\n"
|
---|
257 | " command [arguments]\r\n"
|
---|
258 | " [command [arguments]]\r\n"
|
---|
259 | " ...\r\n"
|
---|
260 | "[ELSE\r\n"
|
---|
261 | " command [arguments]\r\n"
|
---|
262 | " [command [arguments]]\r\n"
|
---|
263 | " ...\r\n"
|
---|
264 | " ]\r\n"
|
---|
265 | "ENDIF\r\n"
|
---|
266 | "if [/i][/s] ConditionalExpression THEN\r\n"
|
---|
267 | " command [arguments]\r\n"
|
---|
268 | " [command [arguments]]\r\n"
|
---|
269 | " ...\r\n"
|
---|
270 | "[ELSE\r\n"
|
---|
271 | " command [arguments]\r\n"
|
---|
272 | " [command [arguments]]\r\n"
|
---|
273 | " ...\r\n"
|
---|
274 | " ]\r\n"
|
---|
275 | "ENDIF\r\n"
|
---|
276 | ".SH DESCRIPTION\r\n"
|
---|
277 | " \r\n"
|
---|
278 | "NOTES:\r\n"
|
---|
279 | " 1. The IF command executes one or more commands before the ELSE or ENDIF\r\n"
|
---|
280 | " commands, if the specified condition is TRUE; otherwise commands between\r\n"
|
---|
281 | " ELSE (if present) and ENDIF are executed.\r\n"
|
---|
282 | " 2. In the first usage of IF, the EXIST condition is true when the file\r\n"
|
---|
283 | " specified by filename exists. The filename argument may include device\r\n"
|
---|
284 | " and path information. Also wildcard expansion is supported by this form.\r\n"
|
---|
285 | " If more than one file matches the wildcard pattern, the condition\r\n"
|
---|
286 | " evaluates to TRUE.\r\n"
|
---|
287 | " 3. In the second usage, the string1 == string2 condition is TRUE if the two\r\n"
|
---|
288 | " strings are identical. Here the comparison can be case sensitive or\r\n"
|
---|
289 | " insensitive, it depends on the optional switch /i. If /i is specified,\r\n"
|
---|
290 | " it will compare strings in the case insensitive manner; otherwise, it\r\n"
|
---|
291 | " compares strings in the case sensitive manner.\r\n"
|
---|
292 | " 4. In the third usage, general purpose comparison is supported using\r\n"
|
---|
293 | " expressions optionally separated by AND or OR. Since < and > are used for\r\n"
|
---|
294 | " redirection, the expressions use common two character (FORTRAN)\r\n"
|
---|
295 | " abbreviations for the operators (augmented with unsigned equivalents):\r\n"
|
---|
296 | " - Expressions : Conditional expressions are evaluated strictly from left\r\n"
|
---|
297 | " to right. Complex conditionals requiring precedence may\r\n"
|
---|
298 | " be implemented as nested IFs.\r\n"
|
---|
299 | " The expressions used in the third usage can have the\r\n"
|
---|
300 | " following syntax:\r\n"
|
---|
301 | " conditional-expression := expression |\r\n"
|
---|
302 | " expression and expression |\r\n"
|
---|
303 | " expression or expression\r\n"
|
---|
304 | " expression := expr | not expr\r\n"
|
---|
305 | " expr := item binop item | boolfunc(string)\r\n"
|
---|
306 | " item := mapfunc(string) | string\r\n"
|
---|
307 | " mapfunc := efierror | pierror | oemerror\r\n"
|
---|
308 | " boolfunc := isint | exists | available | profile\r\n"
|
---|
309 | " binop := gt | lt | eq | ne | ge | le | == | ugt | ult |\r\n"
|
---|
310 | " uge | ule\r\n"
|
---|
311 | " - Comparisons : By default, comparisons are done numerically if the\r\n"
|
---|
312 | " strings on both sides of the operator are numbers\r\n"
|
---|
313 | " (as defined below) and in case sensitive character sort\r\n"
|
---|
314 | " order otherwise. Spaces separate the operators from\r\n"
|
---|
315 | " operands.\r\n"
|
---|
316 | " 5. The /s option forces string comparisons and the /i option forces\r\n"
|
---|
317 | " case-insensitive string comparisons. If either of these is used, the\r\n"
|
---|
318 | " signed or unsigned versions of the operators have the same results.\r\n"
|
---|
319 | " The /s and /i apply to the entire line and must appear at the start of\r\n"
|
---|
320 | " the line (just after the if itself). The two may appear in either order.\r\n"
|
---|
321 | " 6. When performing comparisons, the Unicode Byte Ordering Character is\r\n"
|
---|
322 | " ignored at the beginning of any argument.\r\n"
|
---|
323 | " 7. Comparison Operator Definition:\r\n"
|
---|
324 | " gt : Greater than\r\n"
|
---|
325 | " ugt : Unsigned Greater than\r\n"
|
---|
326 | " lt : Less than\r\n"
|
---|
327 | " ult : Unsigned Less than\r\n"
|
---|
328 | " ge : Greater than or equal\r\n"
|
---|
329 | " uge : Unsigned greater than or equal\r\n"
|
---|
330 | " le : Less than or equal\r\n"
|
---|
331 | " ule : Unsigned less than or equal\r\n"
|
---|
332 | " ne : Not equal\r\n"
|
---|
333 | " eq : Equals (semantically equivalent to ==)\r\n"
|
---|
334 | " == : Equals (semantically equivalent to eq)\r\n"
|
---|
335 | " 8. Error Mapping Functions are used to convert integers into UEFI, PI or OEM\r\n"
|
---|
336 | " error codes.\r\n"
|
---|
337 | " Functions used to convert integers into UEFI, PI or OEM error codes:\r\n"
|
---|
338 | " UefiError : Sets top nibble of parameter to 1000 binary (0x8)\r\n"
|
---|
339 | " PiError : Sets top nibble of parameter to 1010 binary (0xA)\r\n"
|
---|
340 | " OemError : Sets top nibble of parameter to 1100 binary (0xC)\r\n"
|
---|
341 | " Each function maps the small positive parameter into its equivalent error\r\n"
|
---|
342 | " classification.\r\n"
|
---|
343 | " For example:\r\n"
|
---|
344 | " if %lasterror% == EfiError(8) then # Check for write protect.\r\n"
|
---|
345 | " ...\r\n"
|
---|
346 | " 9. Boolean Functions may only be used to modify operators in comparisons.\r\n"
|
---|
347 | " The following built-in Boolean functions are also available:\r\n"
|
---|
348 | " IsInt : Evaluates to true if the parameter string that follows\r\n"
|
---|
349 | " is a number (as defined below) and false otherwise.\r\n"
|
---|
350 | " Exists : Evaluates to true if the file specified by string exists\r\n"
|
---|
351 | " is in the current working directory or false if not.\r\n"
|
---|
352 | " Available : Evaluates to true if the file specified by string is in the\r\n"
|
---|
353 | " current working directory or current path.\r\n"
|
---|
354 | " Profile : Determines whether the parameter string matches one of the\r\n"
|
---|
355 | " profile names in the profiles environment variable.\r\n"
|
---|
356 | " 10. No spaces are allowed between function names and the open parenthesis,\r\n"
|
---|
357 | " between the open parenthesis and the string or between the string and\r\n"
|
---|
358 | " the closed parenthesis. Constant strings containing spaces must be\r\n"
|
---|
359 | " quoted.\r\n"
|
---|
360 | " 11. To avoid ambiguity and current or future incompatibility, users are\r\n"
|
---|
361 | " strongly encouraged to surround constant strings that contain\r\n"
|
---|
362 | " parenthesis with quotes in if statements.\r\n"
|
---|
363 | " 12. Allowable number formats are decimal numbers and C-style case\r\n"
|
---|
364 | " insensitive hexadecimal numbers. Numbers may be preceded by a\r\n"
|
---|
365 | " "-" indicating a negative number.\r\n"
|
---|
366 | " Examples:\r\n"
|
---|
367 | " 13\r\n"
|
---|
368 | " 46\r\n"
|
---|
369 | " -0x3FFF\r\n"
|
---|
370 | " 0x3fff\r\n"
|
---|
371 | " 0x1234\r\n"
|
---|
372 | " 13. Unsigned values must be less than 264. Signed integer values are bounded\r\n"
|
---|
373 | " by -/+263.\r\n"
|
---|
374 | " 14. Numbers are internally represented in two's compliment form. The\r\n"
|
---|
375 | " representation of the number in the string has no bearing on the way\r\n"
|
---|
376 | " that number is treated in an numeric expression - type is assigned by\r\n"
|
---|
377 | " the operator. So, for example, -1 lt 2 is true but -1 ult 2 is false.\r\n"
|
---|
378 | " 15. The IF command is only available in scripts.\r\n"
|
---|
379 | " 16. The ELSE command is optional in an IF/ELSE statement.\r\n"
|
---|
380 | ".SH EXAMPLES\r\n"
|
---|
381 | " \r\n"
|
---|
382 | "EXAMPLES:\r\n"
|
---|
383 | " * Sample script for "if" command usages 1 and 2:\r\n"
|
---|
384 | " if exist fs0:\myscript.nsh then\r\n"
|
---|
385 | " myscript myarg1 myarg2\r\n"
|
---|
386 | " endif\r\n"
|
---|
387 | " if %myvar% == runboth then\r\n"
|
---|
388 | " myscript1\r\n"
|
---|
389 | " myscript2\r\n"
|
---|
390 | " else\r\n"
|
---|
391 | " echo ^%myvar^% != runboth\r\n"
|
---|
392 | " endif\r\n"
|
---|
393 | " Note: In this example, if the script file myscript.nsh exists in fs0:\,\r\n"
|
---|
394 | " this script will be launched with 2 arguments, myarg1 and myarg2.\r\n"
|
---|
395 | " After that, environment variable %myvar% is checked to see if its\r\n"
|
---|
396 | " value is runboth, if so, script myscript1 and myscript2 will be\r\n"
|
---|
397 | " executed one after the other, otherwise a message %myvar% != runboth\r\n"
|
---|
398 | " is printed.\r\n"
|
---|
399 | " \r\n"
|
---|
400 | " * Sample script for "if" command usage 3:\r\n"
|
---|
401 | " :Redo\r\n"
|
---|
402 | " echo Enter 0-6 or q to quit\r\n"
|
---|
403 | " # assumes "input y" stores a character of user input into variable y\r\n"
|
---|
404 | " InputCh MyVar\r\n"
|
---|
405 | " if x%MyVar% eq x then\r\n"
|
---|
406 | " echo Empty line. Try again\r\n"
|
---|
407 | " goto Redo\r\n"
|
---|
408 | " endif\r\n"
|
---|
409 | " if IsInt(%MyVar%) and %MyVar% le 6 then\r\n"
|
---|
410 | " myscript1 %MyVar%\r\n"
|
---|
411 | " goto Redo\r\n"
|
---|
412 | " endif\r\n"
|
---|
413 | " if /i %MyVar% ne q then\r\n"
|
---|
414 | " echo Invalid input\r\n"
|
---|
415 | " goto Redo\r\n"
|
---|
416 | " endif\r\n"
|
---|
417 | " Note: In this example, the script requests user input and uses the if\r\n"
|
---|
418 | " command for input validation. It checks for empty line first and\r\n"
|
---|
419 | " then range checks the input.\r\n"
|
---|
420 |
|
---|
421 | #string STR_GET_HELP_SHIFT #language en-US ""
|
---|
422 | ".TH shift 0 "move parameters 1 down"\r\n"
|
---|
423 | ".SH NAME\r\n"
|
---|
424 | "Shifts in-script parameter positions.\r\n"
|
---|
425 | ".SH SYNOPSIS\r\n"
|
---|
426 | " \r\n"
|
---|
427 | "SHIFT\r\n"
|
---|
428 | ".SH DESCRIPTION\r\n"
|
---|
429 | " \r\n"
|
---|
430 | "NOTES:\r\n"
|
---|
431 | " 1. The SHIFT command shifts the contents of a UEFI Shell script's positional\r\n"
|
---|
432 | " parameters so that %1 is discarded, %2 is copied to %1, %3 is copied to\r\n"
|
---|
433 | " %2, %4 is copied to %3 and so on. This allows UEFI Shell scripts to\r\n"
|
---|
434 | " process script parameters from left to right.\r\n"
|
---|
435 | " 2. This command does not change the UEFI shell environment variable\r\n"
|
---|
436 | " lasterror.\r\n"
|
---|
437 | " 3. The SHIFT command is available only in UEFI Shell scripts.\r\n"
|
---|
438 | ".SH EXAMPLES\r\n"
|
---|
439 | " \r\n"
|
---|
440 | "EXAMPLES:\r\n"
|
---|
441 | " * Following script is a sample of 'shift' command:\r\n"
|
---|
442 | " fs0:\> type shift.nsh\r\n"
|
---|
443 | " #\r\n"
|
---|
444 | " # shift.nsh\r\n"
|
---|
445 | " # \r\n"
|
---|
446 | " echo %1 %2 %3\r\n"
|
---|
447 | " shift\r\n"
|
---|
448 | " echo %1 %2\r\n"
|
---|
449 | " \r\n"
|
---|
450 | " * To execute the script with echo on:\r\n"
|
---|
451 | " fs0:\> shift.nsh welcome UEFI world\r\n"
|
---|
452 | " shift.nsh> echo welcome UEFI world\r\n"
|
---|
453 | " welcome UEFI world\r\n"
|
---|
454 | " shift\r\n"
|
---|
455 | " echo UEFI world\r\n"
|
---|
456 | " UEFI world\r\n"
|
---|
457 | " \r\n"
|
---|
458 | " * To execute the script with echo off:\r\n"
|
---|
459 | " fs0:\> echo -off\r\n"
|
---|
460 | " fs0:\> shift.nsh welcome UEFI world\r\n"
|
---|
461 | " welcome UEFI world\r\n"
|
---|
462 | " UEFI world\r\n"
|
---|
463 |
|
---|
464 | #string STR_GET_HELP_ELSE #language en-US ""
|
---|
465 | ".TH else 0 "part of an 'if' conditional statement"\r\n"
|
---|
466 | ".SH NAME\r\n"
|
---|
467 | "Identifies the code executed when 'if' is FALSE.\r\n"
|
---|
468 | ".SH SYNOPSIS\r\n"
|
---|
469 | "See 'else' for usage.\r\n"
|
---|
470 | ".SH EXAMPLES\r\n"
|
---|
471 | "See 'if' for examples.\r\n"
|
---|
472 |
|
---|
473 | #string STR_GET_HELP_STALL #language en-US ""
|
---|
474 | ".TH stall 0 "stall the operation"\r\n"
|
---|
475 | ".SH NAME\r\n"
|
---|
476 | "Stalls the operation for a specified number of microseconds.\r\n"
|
---|
477 | ".SH SYNOPSIS\r\n"
|
---|
478 | " \r\n"
|
---|
479 | "STALL time\r\n"
|
---|
480 | ".SH OPTIONS\r\n"
|
---|
481 | " \r\n"
|
---|
482 | " time - The number of microseconds for the processor to stall.\r\n"
|
---|
483 | ".SH DESCRIPTION\r\n"
|
---|
484 | " \r\n"
|
---|
485 | "NOTES:\r\n"
|
---|
486 | " 1. This command would be used to establish a timed STALL of operations\r\n"
|
---|
487 | " during a script.\r\n"
|
---|
488 | " 2. Microseconds is in decimal units.\r\n"
|
---|
489 | ".SH EXAMPLES\r\n"
|
---|
490 | " \r\n"
|
---|
491 | "EXAMPLES:\r\n"
|
---|
492 | " * To stall the processor for 1000000 microseconds:\r\n"
|
---|
493 | " Shell> stall 1000000\r\n"
|
---|
494 | ".SH RETURNVALUES\r\n"
|
---|
495 | " \r\n"
|
---|
496 | "RETURN VALUES:\r\n"
|
---|
497 | " SHELL_SUCCESS The action was completed as requested.\r\n"
|
---|
498 | " SHELL_NOT_FOUND The requested option was not found.\r\n"
|
---|
499 | " SHELL_INVALID_PARAMETER One of the passed in parameters was incorrectly\r\n"
|
---|
500 | " formatted or its value was out of bounds.\r\n"
|
---|
501 | " SHELL_DEVICE_ERROR There was a hardware error associated with this\r\n"
|
---|
502 | " request.\r\n"
|
---|
503 |
|
---|