题目
FA25_ISOM_661_4102 Shell - MC Quiz
单项选择题
You want to write a shell script that: Creates a directory called backup, if it doesn't already exist, and Copies all .txt files from the current directory into the backup directory. Which of the following code snippets (if any) will achieve this?
选项
A.mkdir -p backup
cp *.txt backup/
B.None of the other answers is correct
C.mkdir backup
cp *.txt backup/
D.if [ ! -d "backup" ]; then
mkdir backup
fi
cp *.txt backup/
E.if [ -d "backup" ]; then
mkdir backup
fi
cp *.txt backup/
查看解析
标准答案
Please login to view
思路分析
Question: You want to write a shell script that:
Creates a directory called backup, if it doesn't already exist, and
Copies all .txt files from the current directory into the backup directory.
Which of the following code snippets (if any) will achieve this?
Options:
1) mkdir -p backup
cp *.txt backup/
2) None of the other answers is correct
3) mkdir backup
cp *.txt backup/
4) if [ ! -d "backup" ]; then
mkdir backup
fi
cp *.txt backup/
5) if [ -d "backup" ]; then
mkdir backup
fi
cp *.txt backup/
Analysis of each option:
Option 1: mkdir -p backup
cp *.txt backup/
- The -p flag in mkdir ensures that the directory is created if it does not exist and does nothing i......Login to view full explanation登录即可查看完整答案
我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。
类似问题
Question at position 9 Given the following shell variable assignments, a=2; b=5; c=10 Which of the following conditions is true? [ $a –eq 3 –o $b –ge 5 ][ $b –gt 5 ][ $c = (3 + 7) ][ a –eq 2 ]
Shell command (1 mark)How many lines will be output by the following shell command? cat data.csv | awk -F’,’ ’rand()<9/10 {print $9}’[Fill in the blank]
To execute a Unix shell script TEST.SH, you may use
A UNIX shell script program file is
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!