Mac OS command line question?

XCode, AppleScript Java, Unix, Web Code & More!

Mac OS command line question?

Postby 3DNow » Fri Oct 30, 2009 7:56 am

Can anyone please tell me what this command would do in couple of lines and how i can do that from windows?

# touch man.txt ; man touch cat.txt; man cat | man.txt ; wc -l man.txt; kill -9 1

I gotta admit I have no clue but my friend is being a showoff by asking me this kinda question. So I hope someone could save me here.
3DNow
 
Posts: 125
Joined: Sun Jun 21, 2009 5:14 pm

Postby 1872golf » Fri Oct 30, 2009 8:54 am

Haha good one, bro!
1872golf
 
Posts: 107
Joined: Sun Jun 21, 2009 5:24 pm

Postby huanming » Fri Oct 30, 2009 9:51 am

do not run that command!

it's several commands running one after another.
don't trust what your friend says specially in the terminal, i'll tell you why

touch man.txt = create the empty file man.txt
man touch cat.txt = show the manual (help) for the command touch and cat.txt (it will fail since cat.txt is not a command)
man cat | man.txt = show the manual for the cat command and send it to the file man.txt
wc -l man.txt = count the lines in man.txt

kill -9 1 = kills the program that is running with a process id of 1

this last command i will not ever recommend you run.

oh yeah, to do the same thing under windows you put a & between commands

c:\ cd \windows & dir /w & pause & cd .. & dir /w & pause
huanming
 
Posts: 115
Joined: Sun Jun 21, 2009 5:21 pm


Return to Mac Programming & Design