Pages

Thursday, July 25, 2013

Using cat command to see all source code from one folder.

You can see all content of your files using cat command.

I created one function named catt in my .bashrc file.

This is the function you can change to show any type of files not just javascript.

That allow you to working in same folder with many files and see the changes.

If you have another idea about how to see changes in all source of code then just send me one mail or comment.

function catt(){
    for i in *.js;
        do echo "__""$i""__";
        echo "--------------------------";
        cat "$i" -n -b;
        echo "--------------------------";
        done ;
}

And this is result output for all javascript from my node.js folder.

--------------------------
__serv.js__
--------------------------
     1 var sys = require("sys"),
     2 my_http = require("http");
     3 my_http.createServer(function(request,response){
     4  sys.puts("I got kicked");
     5  response.writeHeader(200, {"Content-Type": "text/plain"});
     6  response.write("Hello World");
     7  response.end();
     8 }).listen(8080);
     9 sys.puts("Server Running on 8080");
--------------------------
__test.js__
--------------------------
     1 var sys = require("sys");
     2 sys.puts("Hello World");
--------------------------

One problem can be the number of files parse by this function.

In this case you will not able to see all content of files. Will be to much for you.

But for settings files will work great.