I seriously can't understand where I'm going wrong with his question. The first part is.
List all the file and directory names in /etc which have 1 or more numbers in their name. Remember to use "-d" in the ls command, and do not descend into subdirectories (i.e. no recursion). Save this list in caine's home directory as a file called "digit". Do the "ls" command when CDed to /etc, thus your names avoid having "/etc/" stuck in front of them.
Which is have done with the following command:
ls -d *[0-9]* > digit
However, the second part of the question is;
Redo the previous question, except this time repeat the exercise when CDed in /home/caine. Save the output in digit2. "digit" and "digit2" should be identical, except in "digit2" all the filenames will begin "/etc/".
I thought the following code would work;
ls -d ../../etc/ *[0-9]* > digit2
When I cat the contents of the file, it appears to have ignored the parameters I have set using the *'s and numbers, I have tried moving the statement around and I am stumped as to why this isn't working.
Any advice, or pref an explanation as to where I am going wrong would be much appreciated.
I know this could be achieved with grep, but even though I've moved on to that and am learning it, I'd still really like to know how I can't get the right syntax for this!