Computer Science - Unix - Discussion

Discussion :: Unix - Section 1 (Q.No.4)


Which command is used to copy all files having the string chap and any two characters after that to the progs directory?

[A]. cp chap?? progs
[B]. cp chap* progs
[C]. cp chap[12] /progs/*.*
[D]. cp chap?? /progs/*
[E]. None of the above

Answer: Option A


No answer description available for this question.

Bhanu said: (Jun 17, 2013)  
How do we identify it to be a directory when it is not specified? can't we misinterpret to be a file?

Ramesh said: (Jul 2, 2014)  
Its not the string in the file. But the name of the file itself.

Lakshmi said: (Jul 15, 2014)  
Question says progs directory, so doesnt that mean / should be present ?

Please explain answer.

Subhashree Das said: (Jul 22, 2014)  
If there is directory "progs" then you can not create a file with the same name. When you want to copy multiple files to a single location. Then you can only copy it to a directory, not a file.

Priyanka said: (Jan 24, 2016)  
Hey for copying all files with chap we use * why question mark?

Chet said: (Aug 5, 2016)  
??-> Wha it means?

Amol said: (Aug 20, 2016)  

?? means any two characters. If you used char* it will show files whose name starting from char like, charcoal, character etc.

Sambit said: (Sep 17, 2016)  
The question asking for progs directory without even mentioning the location of it, then why the answer 'D' is not correct while 'A' is correct. Can anybody elaborate?

Harryme said: (Nov 25, 2016)  
?? is first two character.

Mahesh said: (Jan 26, 2017)  
It's working correctly when I used char* but when I used char it occurs an error as.

cp: cannot stat 'chap??': No such file or directory.

How to solve this?

Shekhar said: (Jun 14, 2021)  

Check chap length it should be 6. Then chap? will work.

You used chap* for this length not matters.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.