tags:

views:

69

answers:

4

Hello all,

I am not sure if I can post this sort of question (apologies in advance) but I am trying to build something from this blog post.

# mkdir wkthumb
# cat > wkthumb.cpp

# qmake -project
# qmake && make
# ./wkthumb

I have no experience with this, but I download all the files needed in the directory wkthumb using git. I have gone inside this directory and tried to execute cat > wkthumb.cpp - this just hangs for me. In addition, I thought cat was supposed to be used like this: cat file1.txt file2.txt > file3.txt? The above is blank with the first arguments?

I am using Fedora Core 10.

+2  A: 

The command

cat > wkthumb.cpp

reads from stdin and writes to the file wkthumb.cpp. When you run that it's not hanging, but rather it's waiting for you to type some source code. Copy and paste the source code in that blog post, followed by CtrlD Enter to create the wkthumb.cpp file.

Or, if you've already downloaded wkthumb.cpp through some other method, simply skip the above step.

Greg Hewgill
Oh dear - noob alert! Thank you for the explanation. I did not realise thats how `cat` worked. :)
Abs
A: 

cat with no input is expecting to read from the console. THis is why it appears to be hanging

put

 cat > wkthumb.cpp <<"END"
 ..
 c++ code from blog
 ...
 END
pm100
A: 

If you run cat without file argument(s), it reads input from stdin. If you run it like he's doing, it will basically read whatever you type, and pipe it into the file, until you hit CRTL-D (EOF).

Andy White
A: 

When this appears in a script it takes input from stdin (the keyboard). I'm guessing, but I think you are supposed to type (or paste) the C++ program listed below the script.

MichaelKay