免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4630 | 回复: 0
打印 上一主题 下一主题

HP_UX Bible ----- 第二部分unix 系统基础 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2002-01-19 10:42 |只看该作者 |倒序浏览
第二部分unix 系统基础
The PATH variable is used to define the directories you can:
A. cd into.
B. search through when finding a file.
C. search through to find a command.
D. list files from.
@ c @
C. All the common shells in HP-UX search the directories named in the local
\"ATH\" environmental variable when looking for an executable file.
@ 7 @
What key words define the scope of an \"until\" loop in the POSIX shell?
A. \"begin\" and \"end\'
B. \"do\"and \"end\"
C. \"do\" and \"done\"
D.\"begin\"and \"enduntil\"
@ c @
The script between do and done are looped.
@
18
@
What variable is used to hold the result of test command?
A. $#
B. $error
C. $?
D. $!
@ c @
Use \"echo $?\" to display return value.
@
16
@
Which of the following is NOT a legal Posix shell loop construct?
A. do until done
B. while do done
C. until do done
D. for do done
@ a @
Three loop forms are:
while do done
until do done
for do done
@
18
@
The end of an \"if\" branch is indicated by the keyword:
A. end
B. fin
C. endif
D. fi
@ d @
D. For the Bourne, Korn and Posix shells the \"if\" statement is ended using
the \"fi\" keyword.
@
17
@
The alias shell command is used to create:
A. alternate names for files in your home directory
B. personal shortcuts for frequently used command strings
C. a nickname for you system
D. a second user login for your account
@ b @
alias is for commands. You can unalias an alias.
@ 7 @
What is the difference between local and environmental variables?
A. Environmental variables bring values back to the parent process from
the child process
B. Only local variables can be set up by a normal user
C. A local variable is only known about in the current process whereas an
environmental variable is also known about in child processes
D. A local variable is only known about in the users own processes whereas
an environmental variable is known about by the whole
system
@ c @
export can let local variable to be global.
@ 8 @
In a directory containing the files: abc aabc bac baac bca bcaa, the command
ls *a? would list the following file names:
A. abc aabc
B. bac baac bca bcaa
C. bac baac bcaa
D. abd bac baac
@ c @
C. The file name generation characteristics of the shell would allow \"*a?\"
to match all file names ending in \"a\" \"any character\".
@ 9 @
In \"let\" statements what action does \"/\" represent?
A. escape the meaning of the next character
B. division
C. percentage
D. remainder
@ b @
Use let for arithmetic calculation.
@
18
@
The following is an example of:
VAR=$(date)
A. variable substitution
B. command substitution.
C. tilde substitution.
D. alias substitution.
@ b @
B. The Korn and Posix shells allow a command to be executed and its resulting
output to be substituted in its place in the current command line.
@ 8 @
The default shell used in HP-UX 10.20 and above is the:
A. Korn Shell.
B. C shell.
C. Bourne Shell.
D. Posix Shell.
@ d @
D. On current HP-UX systems the default shell is the Posix shell,
\"/usr/bin/sh\".
@ 7 @
How do you display the contents of the 10th command line argument?
A. echo $10
B. echo ${10}
C. echo $(10)
D. echo {$10}
@ b @
B. The Posix shell features the ability to reference all command line
arguments using their position parameter number. The {} is necessary
to prevent confusion. could represent argument 10 or
@ 8 @
What does the command tr -s \" \" do ?
A. squeeze out multiple spaces from stdin
B. replace all s with \" \"
C. change single spaces into double spaces from stdin
D. translate spaces into s
@ a @
tr means translate.
@
12
@
Which command is used to pull out all lines of a file which contain a
specified pattern ?
A. pr
B. tr
C. wc
D. grep
@ d @
grep is used to searh certain words in certain files.
@
11
@
How would you get a list of the absolute path names of all files in your
home directory, which end in \".c\". The list is to be held in a file called
outfile.
A. find $HOME -name \"*.c\" > outfile
B. find . -name *.c > outfile
C. find $HOME -name \"*.c\" 2> outfile
D. find $home -name *.c > outfile
@ a @
find is very useful.
@
11
@
Assuming that the variable abc is not defined. what is returned by the
command echo \'$abc\' ?
A. blank
B. abc
C. an error message
D. $abc
@ c @
The error may say that the parameter is not set.
@ 8 @
What file name generation string would find all file names that start with
\"a\" or \"A\", end in \"z\", and have exactly 5 characters in them?
A. [aA]*z
B. aA? ? ? z
C. [aA]???z
D. [aA]. *z
@ c @
The correct answer is C.
@ 9 @
What would be returned by the command \"echo $(date)\" ?
A. the current date and time would be shown
B. $(date)
C. the word \"date\"
D. an error
@ a @
$(date) is substituted before echo run.
@ 8 @
The command grep is an adaptation of common command options used with the
_______ command.
A. vi
B. sed
C. ed
D. edit
@
c @
This command name came from the command line options use with the early
ed text editor. Once a file has been opened by ed the command line: g/{re}/p
would print all lines in the opened file containing the {re} pattern to
std-out.
@
11
@
In a \"case\" statement what i s used to distinguish where the set of commands
for one pattern ends, and the next set for the next pattern begin ?
A. ;
B. esac
C. )
D. ;;
@ d @
if .. fi
case … esac
@
17
@
If you entered\"cat myfile > yourfile\" what would be the result on your
screen?
A. the contents of myfile
B. the word \"my file\"
C. an error
D. nothing
@ d @
That\'s the result of redirection.
@
11
@
How do you see the local and environmental variables you
have set up ?
A. env
B. echo
C. Is
D. set
@ d @
Use \"env\" for your global variables.
Use \"set\" for both global and local variables.
@ 8 @
What is the \"`PS1\" environmental variable used for ?
A. the command priority stack
B. the history stack
C. the login sequence
D. the primary prompt
@ d @
# and $ are PS1.
@ 7 @
Under the Korn and Posix shells, how do you pull back your previous
commands ?
A. Escape k
B. Escape p
C. h
D. Escape Escape
@ a @
The command line editor is vi.
@ 7 @
When is /etc/profile run ?
A. for all users logging on
B. when you start a new shell
C. when root logs on
D. for all users logging on under the Kom and Posix shells, not using VUE
or CDE
@ d @
Rememer this trick.
@ 7 @
What is the varlable required to be set to force the .kshrc file to run ?
A. KSH
B. SHELL
C. PATH
D. ENV
@ d @
export ENV=~/.kshrc
@ 7 @
How do you see the contents of a variable?
A. echo variable
B. echo $variable
C. Is $variable
D. set $variable
@ b @
A typical use of variable substitution.
@ 8 @
What command combination would you use if you wanted a sorted listing of
all processes belonging to users, whose names started with\"user\", and you
wanted the list a page at a time?
A. ps -ef | grep user | more
B. ps -ef | grep user | sort | more
C. ps -ef | sort | more
D. ps -ef | grep | sort | more
@ b @
pipes.
@
12
@
What variable holds the third command line argument ?
A. $#
B. $*
C. $third
D. $3
@ d @
echo $0 ${10}
@
16
@
Which variables hold the string of all command line arguments and the number
of them ?
A. $# and $* respectively
B. $* and $0 respectivelv
C. $* and $# respectively
D. $0 and $# respectively
@ c @
C is right.
@
16
@
What does \"test -d abcd\' mean ?
A. does the variable abcd hold a value
B. is the file abcd executable
C. is the file abcd a directory
D. nothing - the syntax is wrong
@ c @
d means directory.
@
17
@
How do you set a value into $? when returning from a shell script ? .
A. $?=value
B. set $? 255
C. $? Can not be set
D. use the exit command
@ d @
eg. exit 99
@
17
@
What is the \"esac\" command used for ?
A. to signify the end of a \"case\" statement
B. to signify the end of a \"while\" statement
C. nothing, it doesn\' t exist
D. to signify the end of a \"branch\" statement
@ a @
case … esac
@
17
@
What does \"let x=x+5\" mean?
A. the variable x will hold the string \"x+5\"
B. the variable x will hold the ASCll code number for x plus 5
C. the variable x will hold its original value plus 5
D. the variable x will hold the value 5
@ c @
Use let to +,-,* and /.
@
18
@
What is the purpoase of a \"continue\" command ?
A. to proceed with a shell script after a pause command
B. to continue processing an infinite loop from the current point
C. to go back to the start of a loop structure
D. to proceed wi th a shell script after a sleep command
@ c @
Please distinguish between break and continue.
@
18
@
If you wanted to append the contents of file f1 to the end of file f2 how
would you do it using input/output redlrection ?
A. cat f1 >> f2
B. cat f1 > f2
C. cat f1 cat f2
D. cat f1 f2>f2
@ a @
Use >> to append.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP