21⟩ Which command can be used to test various file attributes a) if b) file c) test d) type
c) test
“Linux OS Shell frequently Asked Questions by expert members with experience in Linux Shell. These questions and answers will help you strengthen your technical skills, prepare for the new job test and quickly revise the concepts”
c) test
c) linux bash
c) one character
b) $*
a) to define a variable within a function for its local scope
a) cmd1 | cmd2
b) Linux
Explanation:
If local variable name is same as the global variable, it overlays the variable, but only within the function.
Output:
root@ubuntu:/home/google# ./test.sh
Linux
root@ubuntu:/home/google#
c) This is the first function
This is the second function
a) This is the first function
This is the second function
This is the third function
Output:
root@ubuntu:/home/google# ./test.sh
This is the first function
This is the second function
This is the third function
root@ubuntu:/home/google#
d) all of the mentioned
a) google
$san_var
"$san_var"
'google'
$san_var
Explanation:
Using double quotes does not affect the substitution of the variable, while single quotes and backslash do.
Output:
root@ubuntu:/home/google# ./test.sh
$san_var
"$san_var"
'google'
$san_var
root@ubuntu:/home/google#
d) both (a) and (b)
Explanation:
The doller sign ($) is used to access a variable's value, not to define it.
Output:
root@ubuntu:/home/google# ./test.sh
./test.sh: line 3: 10=20: command not found
10
root@ubuntu:/home/google#
d) san_1 san_2 san_3
Explanation:
All items of an array can be accessed by using ${[*]} or ${[@]}.
Output:
root@ubuntu:/home/google# ./test.sh
san_1 san_2 san_3
root@ubuntu:/home/google#
a) unset
c) The pipe operator provided by the shell can be used
b) Write standard output and standard error to abc
b) No output is displayed
d) syntax error
b) $#
d) command 2> /dev/null