Computer Science - Unix - Discussion

Discussion Forum : Unix - Section 1 (Q.No. 4)
4.
Which command is used to copy all files having the string chap and any two characters after that to the progs directory?
cp chap?? progs
cp chap* progs
cp chap[12] /progs/*.*
cp chap?? /progs/*
None of the above
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
11 comments Page 1 of 2.

Shekhar said:   4 years ago
@Mahesh.

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

You used chap* for this length not matters.

Mahesh said:   9 years ago
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?

Harryme said:   9 years ago
?? is first two character.

Sambit said:   9 years ago
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?
(1)

Amol said:   9 years ago
@Chet.

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

Chet said:   9 years ago
??-> Wha it means?
(1)

Priyanka said:   10 years ago
Hey for copying all files with chap we use * why question mark?

Subhashree Das said:   1 decade ago
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.

Lakshmi said:   1 decade ago
Question says progs directory, so doesnt that mean / should be present ?

Please explain answer.

Ramesh said:   1 decade ago
Its not the string in the file. But the name of the file itself.


Post your comments here:

Your comments will be displayed after verification.