1.
題目:
$MYVAR1="Happy"
$MYVAR2="Birthday"
$export MYVAR1
$bash
$echo $MYVAR1 $MYVAR2
$exit
$echo $MYVAR1 $MYVAR2
a. Was the behavior of the two echo commands identical?
b. If so,why?If not,why not?
c. What happened immediately after the bash command?
d.Which variable is an environment variable?
實際執行過程:
Happy Birthday
答案:
2.題目:
enter Ctrl-P until you see the last echo command.Enter Ctrl-P again.
a. What do you see?
b. Why wasn't it the exit command?
c. Enter Ctrl-P again so that the export command is displayed.
Add a space and MYVAR2 so that the line now looks like this:
$export MYVAR1 MYVAR2
What happens when you enter this command?
答案:
[Niki@14:29:42 ~]$ #a. bash
[Niki@14:29:56 ~]$ #b. because exit command is new instruction of bash
[Niki@14:30:45 ~]$ MYVAR1="Happy"
[Niki@14:31:01 ~]$ MYVAR2="Birthday"
[Niki@14:31:16 ~]$ export MYVAR1
[Niki@14:31:32 ~]$ bash
[Niki@localhost ~]$ echo $MYVAR1 $MYVAR2
Happy
[Niki@localhost ~]$ exit
exit
[Niki@14:32:05 ~]$ echo $MYVAR1 $MYVAR2
Happy Birthday
[Niki@14:32:26 ~]$ export MYVAR1 MYVAR2
[Niki@14:32:54 ~]$ bash
[Niki@localhost ~]$ echo $MYVAR1 $MYVAR2
Happy Birthday
[Niki@localhost ~]$ exit
exit
[Niki@14:33:22 ~]$ echo $MYVAR1 $MYVAR2
Happy Birthday
[Niki@14:33:25 ~]$ #c. we can see Happy Birthday
3. 題目:
The file command is used to examine a file's contents and displays
the file type.
Explain the result of using file as follows:
$cd / ; file $(ls | head -10)
實際執行過程:
答案:路徑指向根目錄,且顯示10個檔案的file type
留言列表