Title: LPIC 102 Q/A / 05 Shells and Shell Scripting

Q: Which of the following best describes the PS1 environment variable?
PS1 is used to set the location of the PostScript command.
PS1 is used to define the default shell prompt for bash.
PS1 is used as a per-system variable.
PS1 is user-defined and does not have a default value or setting.
A: B. The PS1 variable usually has its default set in /etc/profile and is used as the shell prompt. Users can customize the prompt to include hostname, working directory, and other elements.

Q: Which command is used to read and execute commands from a file in the Bash shell?
run
execute
source
func
A: C. The source command is used to execute commands from a file. A typical use case is to create functions or variables that are then available for use within the current session. The other commands listed do not exist.

Q: You need a command to be executed on logout for all users. Within which file should this be placed (assuming all users are using Bash)?
∼/.bash_logout
/etc/bash.bash_logout
/home/.bash_logout
/etc/bash_logout
A: B. While it’s true that every user has a .bash_logout in their home directory, that file can still be edited by the user. Therefore, to ensure that the required command is executed at logout, the /etc/bash.bash_logout file must be used.

Q: Which of the following commands removes an environment variable that has been set?
profile --unset
env -u
set -u
import
A: B. The env -u command will unset an environment variable for the current session. The unset command can also be used for this purpose.

Q: Which option to the unset command explicitly informs the command that the name given refers to a shell variable and not a function?
-a
-s
-v
-e
A: C. The -v option, which is the default, tells unset that the name given is a shell variable rather than a function. The other options shown do not exist.

Q: Which of the following commands ensures that the -la options are used when the ls command is executed without other options?
alias ls="ls -la"
ln -s ls ls -la
alias "ls -la" = ls
set ls
A: A. The alias command is used for this purpose and its format is name=value, making option A correct. The ln command cannot be used for this purpose because it will not accept command-line arguments for the target in such a format, as shown in the options.

Q: What is the order in which user configuration files are located on login to a Bash shell?
.bash_login, .profile, /etc/profile
.bash_profile, .bash_login, .profile
.profile, .bash_login, .bash_profile
.bash_login, .bash_profile, .profile
A: B. User-based configuration files are located in the order .bash_profile, .bash_login, and .profile. Only the first file found is executed and the others are ignored.

Q: Which variable within a Bash script is used to access the first command-line parameter?
$ARG
$CMD
$1
$ARG0
A: C. The $1 variable is automatically available within Bash scripts and represents the first command-line argument. The other variables listed in this question do not exist by default.

Q: Which of the following provides the end for an if conditional in a Bash script?
ex
}
]
fi
A: D. The fi construct is used to indicate the end of an if conditional within a Bash script. In many languages, if conditionals are scoped by braces such as { }, but in shell scripting, fi is used to denote the end of the condition.

Q: Which of the following commands will print a list of 6 numbers beginning at 0 within a Bash script?
list 0-5
seq 0 1 5
echo 0-5
seq 0 1 6
A: B. The seq command is used to print a sequence of numbers in a variety of formats. The answer for this question provides a starting point (0), and increment (1), and the final number (5), resulting in six numbers being displayed as output.

Q: When creating a shell script, which of the following commands is used to display the contents of variables?
var_dump
echo
ls
env
A: B. The echo command is used to display its argument, regardless of whether the command is used inside a shell script or from the command line itself. The env command is used to display environment variables and therefore does not meet the need specified in the question. The var_dump command is used within PHP, and ls is used to display contents of directories.

Q: A command has the following listing obtained with ls -la:
-rwsr-xr-x 1 suehring suehring 21 Nov 2 13:53 script.sh
What does the s denote within the user permissions in the listing?
The suid bit has been set for this program.
This is a symlink.
The file will not be executable.
The file is a special system file.
A: A. The suid bit enables the program to run as the user who owns the file regardless of who executes the program. Using SUID is typically not recommended for security reasons.

Q: Which of the following commands will execute a script and then exit the shell?
run
source
./
exec
A: D. The exec command executes the command given as its argument and will then exit the shell. The source command does not exit the shell.

Q: Which sequence of characters will execute two commands but only if the first command exits successfully?
--
&*
&&
&
A: C. The double-ampersand sequence executes commands only if the previous command exited cleanly.

Q: Which command within a shell script awaits user input and places that input into a variable?
exec
get
read
prompt
A: C. The read command awaits user input and places that input into the specified variable. The exec command is used to execute commands, and the other options are not valid for the purpose described.

Q: What characters are used to mark a sequence of commands as a function in a Bash script?
Parentheses to declare the function (optional) and curly braces to contain the commands
Curly braces to declare the function and parentheses to contain the commands
Square brackets to declare the function and curly braces to contain the commands
Runquotes to denote the function
A: A. Parentheses are used to denote a function, such as myFunction(). The parentheses are optional but are then followed by curly braces containing the commands to be executed when the function is called.

Q: Which character sequences denote an alternate command to execute if the preceding command does not exit successfully?
&&
--
||
EL
A: C. The || sequence indicates an alternate command to run if the initial preceding command does not exit cleanly. The && sequence executes only when the preceding command exits cleanly, so it’s just the opposite of what the question was asking.

Q: Which keyword(s) is/are used to begin an alternate condition within a Bash script?
if
else if
elif
elsif
A: C. The elif keyword is used to create an alternative execution path within a shell script. The other constructs, such as else if and elsif, are used in other languages.

Q: Which of the following commands removes a currently defined aliased command?
remove
rm
unalias
delete
A: C. The unalias command is used to remove a previously defined alias. The rm command will remove regular files but not aliases. The other commands do not exist.

Q: When sourcing a file in Bash, which chmod command would be necessary to provide the minimum privileges in order for the file to be sourced correctly, assuming that your current user owns the file?
chmod 600
chmod 755
chmod 777
chmod 400
A: D. At a minimum, you need to be able to read the file being sourced; therefore, chmod 400 will correctly set the permissions. Any chmod that gives additional permissions is not necessary.

Q: Assuming that a space-separated list of values has been defined as LIST="one two three four", which of the following for loop constructs will iterate through the elements in the list?
for LIST
for VAR in LIST
for VAR in $LIST
for $LIST -> $VAR
A: C. The for loop construct in this case will require the variable name LIST to be preceded with a dollar sign ($),making option C correct. The other options will not work for the purpose described.

Q: Which test within a shell script while loop will examine one value to see if it is less than another?
-less
-lessThan
-lt
-lthan
A: C. The -lt operator is used to test for “less than” conditions within a script. The other operators are not valid for use in a shell script.

Q: Which of the following tests will determine if a file exists in the context of a shell script?
-a
-e
-m
-i
A: B. The -e test checks to ensure that a file exists and is typically used in the context of a conditional within a shell script. The other options may work within shell scripts but are not tests for file existence.

Q: Within which directory should you place files to have them automatically copied to a user’s home directory when the user is created?
/etc/userhome
/etc/templateuser
/etc/skel
/home/skel
A: C. The /etc/skel directory contains files to be copied to the user’s home directory. The other directories listed for this question do not exist by default.

Q: Which option to bash will cause the shell to be executed without reading the initialization files?
--no-rc
--no-init
--norc
--rc-none
A: C. The --norc option causes bash to execute without reading the /etc/bash.bashrc file or the local ~/.bashrc file. The other options listed do not exist as options for bash.

Q: Which of the following creates an array in a Bash script?
ARRAY=(val1 val2)
ARRAY = "val1 val2"
ARRAY_PUSH($ARRAY,"val1","val2");
ARRAY{0} = "val1"
A: A. Array creation in a shell script involves parentheses when used in this manner. You can also use square brackets to define individual elements, as in ARRAY[0] = "val1".

Q: Which option of declare displays output in a way that could then be used as input to another command?
-o
-n
-p
-m
A: C. The -p option to declare displays fully qualified shell statements such that the statements could then be used as input for another command, either through piping or redirection to a script.

Q: You need to create a function that will be available each time that you log in to the system. Within which file should this function be placed?
.bash_profile
.rc
/etc/profile
.bash_run
A: A. The .bash_profile file, if it exists in your home directory, will be executed on login. Note that placing the function in /etc/profile would technically work but then the function would be available to all users, which is not what the question asked for.

Q: Which shell built-in command is used to display a list of read-only variables?
ro
readonly
env-ro
ro-env
A: B. The readonly command displays the list of read-only variables that have been declared in the current session. The other commands listed for this question do not exist.

Q: Which characters are used to denote the beginning and end of the test portion of a while loop in a shell script?
Parentheses ( )
Curly braces { }
Square brackets [ ]
Double-quotes " "
A: C. Square brackets are used to denote the beginning and end of the test portion of a while loop in a shell script. Other languages generally use parentheses for this purpose.

Q: When using the test built-in with one argument, what will be returned if its argument is not null?
false
true
unknown
-1
A: B. The test built-in will return true and can be used to test for the value existence of a variable not being null. Note that the behavior of the test built-in differs depending on the number of arguments.

Q: Which environment variable is used when changing directory with the tilde character, such as cd ∼ ?
HOMEDIR
HOMEPATH
HOME
MAILPATH
A: C. The HOME environment variable, set automatically to the user’s home directory, is consulted when the command cd ~ is entered. The other paths beginning with HOME do not exist by default, and the MAILPATH environment variable shown contains a list of locations where mail is checked when using the shell interactively.

Q: Which environment variable can be set if you want to automatically log users out of their shell after a certain period of inactivity?
TIMEOUT
TMOUT
TO
IDLETIME
A: B. The TMOUT variable can be set in a given user’s shell and that user will be logged out after the value given (in seconds) of inactivity. The other environment variables listed here do not exist.

Q: When using a case statement within a shell script, which sequence denotes the ending of the case/switch statement?
caseend
esac
endcase
}
A: B. Just as with an if statement where the statement is ended with fi, so too is a case statement ended with the word case spelled backward. The curly brace shown as option D is used to close case statements in many languages, but not for shell scripts.

Q: Which of the following commands will obtain the date in seconds since the epoch and place it into a variable called DATE within a shell script?
DATE="$(date +%s)"
DATE="date"
DATE="$(date)";
DATE="$date %s"
A: A. The provided answer performs command substitution and places the value from the resulting command into a variable. Note the use of +%s formatting on the date, which then formats the output as seconds since the epoch, as specified in the question. Option C will provide the date within the DATE variable but will not format it as specified.

Q: Assume that you have a variable called $FILEPATH within a Bash shell script. Which characters can be used to ensure that the variable will be interpolated correctly regardless of where the variable appears within the script?
Dollar sign: $FILEPATH
Curly braces: ${FILEPATH}
Parentheses: $(FILEPATH)
Square brackets: $[FILEPATH]
A: B. Wrapping a variable in curly braces, such as ${FILEPATH}, will ensure that the variable is interpolated or expanded correctly even when used in a place where it might not normally be expanded, such as within a quoted string.

Q: Which sequence is used to mark the beginning and end of the commands to execute within a for loop in a shell script?
Curly braces: { }
The keywords do and done
Semicolons: ;
Tabs
A: B. In shell scripts, the commands to execute begin at the do keyword and end at the done keyword. Other languages generally use either curly braces or tabs.

Q: Which of the following tests will determine if a file exists and can be read by the user executing the test?
-e
-m
-a
-r
A: D. The -r test determines whether a given file exists and can be read by the current user. The -e test only checks to see if the file exists.

Q: Which option of the declare command will create a variable that is read-only?
-r
-ro
-p
-x
A: A. The -r option to declare will create or mark the variable as read-only. The -p option prints output in a format that can be reused. The -x option declares the variable for export.

Q: Which character sequence is used to provide a default case when used within a case statement in a shell script?
default:
=)
-->
*)
A: D. The *) sequence is used to denote a default set of statements that will be executed if no other case matches within the set.

Q: Which character sequence can be used for command substitution in Bash?
Backquotes: ` `
Single quotes: ‘ '
Double quotes: ""
Backslashes: \\
A: A. Backquotes can be used for command substitution within a Bash script. The other options shown are not valid for command substitution.

Q: When using a while loop in Bash, which character sequence marks the end of the loop?
elihw
done
end
od
A: B. The character sequence done denotes the end of a while loop in Bash.

Q: Which operator is used to test if a value is greater than or equal to something in a Bash script?
!=
>=
=>
>>
A: B. Greater than or equal to is tested with >=. Of the other operators shown, != tests for inequality.

Q: You are working with a shell script called listusers and the script does not execute with the error "permission denied". What could be the possible cause of this issue?
The script should have an .sh extension.
The script contains a syntax error.
The script does not have its execute permission set correctly.
The script is named with lowercase letters.
A: C. The execute bit is not set on the script, resulting in the permission denied error, making option C correct. The file extension does not matter, so option A is incorrect. Likewise, option B is not correct because the script isn’t even executing. Lowercase or uppercase letters do not matter, making option D incorrect.

Q: Which option to the export built-in command makes names available as functions to child processes?
-m
-e
-w
-f
A: D. The -f option exports names as functions to child processes. The other options shown do not exist with the export command.

Q: If a variable has been created using the set command, which command can be used to remove the variable?
remove
del
delete
unset
A: D. The unset command removes a variable from being set. The other options shown do not exist.

Q: Which of the following files is a systemwide initialization script for Bash?
/etc/bash.bashrc
/etc/bash.init
/etc/bash.cfg
/etc/bash/bash.init
A: A. The /etc/bash.bashrc file is a systemwide configuration file for the Bash environment. Another systemwide file used for similar purposes is /etc/profile.

Q: Which option to the set command enables debugging output?
-d
+d
-x
+x
A: D. The +x option enables debugging output and is frequently used when debugging shell scripts. The -x option is used to disable debugging. The -d and +d options do not exist.

Q: Which of the following files is executed with every interactive Bash shell invocation?
/etc/bash.d
/etc/bash.interactive
∼/.bash_inter
∼/.bashrc
A: D. The .bashrc file in a given user’s home directory is executed for interactive logins. The other files shown do not exist.

Q: Which keyword declares a block of code to be a function in a Bash script?
function
repeat
func
block
A: A. The function keyword declares a block of code to be a function in Bash. It’s worth noting that the function keyword can be omitted in most cases. The other options are not valid.

Q: Which of the following statements adds the /srv/bin path to the path for a Bash shell?
PATH=/srv/bin
PATH=$PATH:/srv/bin
PATH = /srv/bin
PATH=/srv/bin;$PATH
A: B. The syntax shown in option B is the correct syntax to add a path to the current environment. Option A does not include the existing path (and will, in fact, overwrite the existing path). Option C contains spaces, and option D uses a semicolon as a delimiter.

Q: Which variable is available to a Bash script and contains the name of the script itself?
$SCR
$SCRIPT
$CMD
$0
A: D. The $0 variable is automatically defined and contains the name of the script itself. The other options shown do not exist by default.

Q: Which option to the seq command sets a delimiter of a space between the numbers 1 through 5?
seq -s ' ' 1 5
seq -d ' ' 1 5
seq 1 5
seq -m 1 5
A: A. The -s argument enables setting of a delimiter. When used, the numbers will be printed in a sequence rather than one per line. The -m and -d options do not exist.

Q: Which file test is used to determine if you are the owner of the file being tested?
-m
-k
-w
-O
A: D. The -O option is used to determine if the user currently running the test is the owner of the file being tested. The -k option checks to see if the sticky bit has been set. There is no -m file test.

Q: When testing a return value in a Bash script, which exit code indicates success?
0
1
2
C
A: A. A successful return from a command executed within a Bash script is 0. A 1 or higher typically indicates an error condition. There is no C condition.

Q: You have created a README file and placed it into /etc/skel so that users get the file in their home directories. The file is missing from some home directories on the system. Which of the following best explains this scenario?
The file is not copied automatically for existing users.
The file is too big for a user’s home directory.
The file already exists.
The file needs a file extension.
A: A. The file is not copied to directories for existing users, making option A correct. There is nothing in the question to indicate that the file is too big or that it already exists. File extensions don’t matter in Linux, so option D cannot be correct.

Q: You have a Bash script that uses the following find command:
find . -name ".git" -type d
When another administrator uses the script, it does not find all of the indicated directories. Which of the following is the best explanation for this scenario?
The find command is tied to specific users.
The find command cannot find directories beginning with a dot.
The find command begins the search in the current directory.
The find command cannot find directories.
A: C. The find command begins the search in the current directory, which is problematic in a scripted scenario like the one presented. The find command can find directories, and those directories can begin with a dot character.

Q: You have specialized software that needs to be installed with an empty environment. Which option to the env command can be used to meet this requirement?
-e
–i
-f
-c
A: B. The -i option ignores the environment. The other options are not valid for use with env.

Q: Which option enables debugging when used on the interpreter (#!) line within a Bash script?
-x
-d
-a
-f
A: A. The -x option enables debugging when passed on the interpreter line of a Bash script. The other options are not valid for this purpose.

Q: Which of the following will output the number 5 as part of a Bash script?
echo 2+3
echo 2 + 3
echo $[2+3]
echo ${2+3}
A: C. Doing math in Bash requires a special syntax. The bc command can also be used for such operations and is frequently used for math within Bash scripts.

Q: You need to prompt the user to enter two values in a Bash script and capture them in variables VAL1 and VAL2. Which of the following commands can be used for this purpose?
read VAL1 VAL2
prompt VAL1 VAL2
VAL1=$0 VAL2=$1
(VAL1 VAL2) = prompt
A: A. The read command will be used, and option A shows the correct syntax. Option C is incorrect because it does not prompt the user. There is no prompt command, making options B and D incorrect.

Q: Which option to the export built-in command removes a variable from being exported?
-m
-o
-r
-n
A: D. The -n option removes a variable from being exported. The other options do not exist.

Q: Which of the following tests the return value from the previous command to see if the command was successful?
if [ $? -eq 0 ];
if [ $? = 0 ];
if ($PREV == 0) {
if [ $RETV === 0 ];
A: A. The exit code from the previous command is captured automatically in the $? variable, thus ruling out any option that did not have this value. A test for the value is done with -eq in a Bash script, thus making option A correct.

Q: You have a file containing bash functions. Which command can be used to add these functions to the current environment?
function
include
require
source
A: D. The source command is frequently used for the purpose described. The function command can be used to create functions but would not be used for the purpose described. The include and require commands are not valid.

Q: Which chmod command grants the user execute permission on a script?
chmod user += exec
chmod u+x
chmod 644
chmod u+all
A: B. Adding the execute bit for the user can be done in a non-octal format, as shown in option B. The only other valid chmod option is 644, which does not grant execute permission.

Q: Which find command will locate all files named with an .sh extension?
find / -name "*.sh"
find / -name "*.sh" -type f
find / -name "*.sh" -type d
find ./ -name "*.sh"
A: B. The problem statement specified files, making option B the best answer. Option A will also find directories.

Q: Which unset option can be used to remove a function from being defined?
-r
-a
-f
-g
A: C. The -f option removes a function. The other options do not exist for the unset command.

Q: When setting the shebang line of a shell script, which of the following commands will help to determine the location of the interpreter automatically?
/bin/int bash
A: A. The env command, when used as #!/usr/bin/env bash, will determine the location of the Bash interpreter automatically. This makes the resulting script more portable for systems where Bash may not be located in /bin/.

Q: Which mathematical operator is used for division within a Bash script?
\
/
*
//
A: B. The front slash, or forward slash, is used for division. Of the other options, an asterisk is used for multiplication and the other options are not valid.

Q: You need to send an email to the superuser if a command is successful. Which of the following commands will send mail from a Bash script?
smtpsend
mailx
sendm
mailsend
A: B. The mailx command can be used to send mail from the command line. The other options shown are not valid commands.

Q: Which file test operator is used to determine if the file is not zero size?
-d
-e
-f
-s
A: D. The -s operator tests if a file is not zero size. The -d operator looks for directories, whereas -e merely checks if the file exists.

Q: You have created an alias but it is gone the next time you log in. Which of the following best explains this scenario?
The alias was not placed into an initialization script.
The alias was invalid.
The command is not valid for which the alias was created.
The alias created an invalid symlink.
A: A. An alias exists only for the length of the current session, making option A correct. If the alias or command was invalid, you would have seen it immediately when you created or used the alias.

Q: Which of the following is valid syntax to create a variable named FILENAME in a Bash script and set it equal to the second command-line argument?
$FILENAME = $2
FILENAME=1
FILENAME = $(2)
FILENAME=$2
A: D. The correct syntax is shown in option D for the scenario described.

Q: You are working with a user who is reporting that their environment does not have certain variables defined, but other users do have those same variables available within their environment on login. The issue was not corrected by having the user log out and then log in again, and you can see their successful login. What is the most likely explanation for this issue?
The user has logged in from the console.
The user is using a different shell.
The user has removed the environment variables manually.
The user is logging in to a different system.
A: B. The user is most likely not using Bash but is rather using another shell like Tcsh. The user could be logging into a different system, but hopefully by having them log out and log in again that would have been noticed, as would their manual removal of the environment variables.

Q: Which environment variable contains the username of the currently logged-in user?
LOGNAME
LOGIN
LOGGEDIN
LOGINUSER
A: A. The LOGNAME environment variable contains the currently logged-in user. The other variables do not exist by default.

Q: Which file test operator is used to determine if the file is a symbolic link?
-h
-p
-S
-t
A: A. The -h test determines if the file is a symbolic link. The -p option tests if the file is a pipe, and -S returns true if the file is a socket. The -t test determines if the file is a terminal.

Q: Which option to the readonly command marks a function as being read-only?
-a
-r
-f
-p
A: C. The -f option marks a function as read-only. The -p option prints a list of read-only identifiers. The -a option assumes that the name is an array, and there is no -r option to the readonly command.

Q: Which find command will locate all files where the users have the execute bit set?
find ./ -type f -perm 700
find / -type f -perm -u+x
find / -type f -perm 777
find / -type f -perm -execuser
A: B. Option B is the best answer because it will find files where the user permission includes the execute bit. It’s worth noting that options A and C will find the execute bit but only with the exact permissions specified.

Q: According to the FHS, which of the following directories is used for local binaries?
/usr/local/bin
/usr/bin
/usr/sbin
/home/scripts
A: A. The /usr/local/bin directory is the location specified for local binaries according to the FHS. It’s also a typical place for scripts as well. The /usr/bin and /usr/sbin directories are for system binaries, and /home/scripts does not exist by default.

Q: Which key sequence can be used to terminate a Bash script?
Ctrl+d
Ctrl+l
Ctrl+a
Ctrl+c
A: D. Ctrl+c is used to terminate a script and is usually used for terminating programs as well.

Q: You need to view the current environment variables in a single line rather than with newlines separating each variable. Which option to the env command can be used for this purpose?
-n
-0
-c
-e
A: B. The -0 option follows each environment variable with a null byte rather than a newline. The other options shown are not valid for use with env.

Q: You are attempting to copy several files, but the cp command keeps asking for confirmation before overwriting. Which of the following best describes the most likely cause?
The cp command has been compiled to ask for confirmation.
The cp command always prompts for confirmation.
The cp command cannot be used for the purpose described.
The cp command has been aliased to include the -i option.
A: D. In all likelihood, the cp command has been aliased with the -i option. Running unalias cp will correct the issue. It is possible that the cp command has been recompiled to always ask for confirmation, but this is not the most likely cause.

Q: You receive an exit code of 1 when working with the grep command in a Bash script. What does exit code 1 mean with grep?
Error
Success
Search pattern not found
Search pattern found
A: C. An exit code of 1 usually means error, but in the case of grep it means that the search pattern was not found.

Q: Which of the file test operators is used to determine if a file is a directory?
-e
-d
-w
-a
A: B. The -d test checks if a file is a directory. The -e option checks for existence, and the -a option is no longer used. The -w test checks to see if a file is writable by the current user.

Q: Which of the following statements prepends the /usr/local/bin path to the path for a Bash shell?
$PATH=/usr/local/bin:$PATH
PATH=/usr/local/bin:$PATH
PATH=$PATH:/usr/local/bin
PATH=$PATH;/usr/local/bin
A: B. The command shown prepends /usr/local/bin on to the existing path. Option A uses $PATH, which is the incorrect identifier for the left side of the assignment. Option C appends /usr/local/bin rather than prepends, and option D uses a semicolon as a delimiter.

Q: Which looping construct is executed at least once in a Bash script?
while
for
until
case
A: C. The until loop construct will execute at least once before the condition is evaluated. The while and for loops both evaluate the condition first. The case statement is not a loop construct.

Q: Which character or character sequence is equivalent to the source built-in in Bash?
<>
.
->
%
A: B. The single dot, ., can be used as a means to source environment variables. The other characters and character sequences do not work for the purpose described.

Q: Which option to the export built-in command displays the list of exported variables?
-p
-a
-t
-d
A: A. The -p option displays all exported variables. The other options shown do not exist.

Q: Which character or character sequence denotes the beginning of a while loop in a Bash script?
start
{
>>
do
A: D. The word do indicates the beginning of a while loop in a Bash script. The other options shown are not valid for the purpose described.