hi, i had a few unix questions that I am not sure about the answers. if anybody can give a try... that would be great.

1. In sed, when you do pattern matching, the largest pattern is always matched first, left to right. True or False

2. The command tr 'a-z' 'A-Z' | tr 'A-Z' 'a-z'
after the command is run, case of the input stream will be swapped. True or False
# i tried, the output is a bit weird....

3. File substitution always happens on variable assignment. True or False

4. In the command
echo "hello world" >&2 2>outfile
both standard output and standard error are sent to outfile True or False

5. Which statement best describes when filename generation (expansion) can occur?
a. inside of single quote
b. ......... double quote
c. ........... backquote
d. B & C
e. A and B and C

6. The command
rm "-foobar"
will correctly delete a file named, -foobar
True or False

7. The program 'ls' is a UNIX filter
True or False

Smells like homework - where's your attempt at answers?

Yeah... where are you taking this "quiz"?
You seem to have a lot of questions, and it is certainly hard to tell if its because you are trying to learn or cheat. If its just an online quiz - can you provide a link? I'd be interested in taking a try myself.

this is homework and i probably shoulda mention. However, it is all open book open notes and free to discuss with classmates or anybody else. There are totally 42 questions and I am not sure about these 6 or 7.

I had many questions posted but most of them weren't asking anyone to do anything bigger than one line of script. It is just I had encountered many new situations being new to shell scripting. And I solved my own problem and posted it for whoever needs the solution too... so...

i love this site becoz most post got answered... not all answers are the right answer but it always gave me hints and of coz sometimes just the exact answer.

if anybody doesn't feel ok to answer some question looks like hw.. it is fine... and i didn't know those questions shouldn't be posted.

http://www.daniweb.com/forums/announcement113-2.html
Posting them is fine, so long as you show some effort.

You almost made it with
"# i tried, the output is a bit weird...."
but it would have been better if you'd actually copied and pasted what you tried.

Question 1 is answered in the manual

http://www.daniweb.com/forums/announcement113-2.html
Posting them is fine, so long as you show some effort.

You almost made it with
"# i tried, the output is a bit weird...."
but it would have been better if you'd actually copied and pasted what you tried.

Question 1 is answered in the manual

Question 1 I actually found it the answer true somewhere on a unix tutorial website.... however, i don't get what it meant by the largest pattern; to match with . or * , * is probably the larger pattern but why matched first.... ==' i don't see it.

Question 2 i got below
$ a="main street NEW YORK USA"
$ echo $a | tr 'a-z' 'A-Z' | tr 'A-Z' 'a-z'
main street NEW YORK USa

my interpretation is it should translate $a 's lower case to upper case .. and then it should be all upper case... and translate to lower case... however, the result remain the same but USa instead of USA... isn't it weird???

Question 1. What if the same pattern also fits inside the "largest" pattern? i.e

pattern: A.*B
String: ABCDEFBGHIJK

Is AB matched, or is ABCDEFB matched?

Question 2:

What is th difference between 'A-Z' and '[A-Z]'? (Although there are other things in tr that should be used for this.)

Question 3:

Are you sure you copied it right as:
File substitution always happens on variable assignment.
doesn't seem right to me.

Question 4:

Knowing that handle>&handle redirects the first handle to whatever "stream" the second handle currently points to, and handle>outputStream redirects the listed handle to a newly created output stream, what do you think the answer is? Hint, the keyword in that question is marked.

Question 5:

Simply try it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.