Thursday, August 27, 2009

tricks with bash

some micelaneous stuff learned when working in Safe Software:

in bash, you can use !! to indicate the last command typed in shell. This is useful when you want to debug the previous command you have just typed.

&> directive can pass only the standard in to a file and still have both standard out and err into the stdin of the terminal

>& does the reverse, passing std err to file

$ returns the value of the variable, $(command) returns the result of the command

^cat^less will scrach out the cat and replace the string with less, and will run less on the file. this is useful for editing a long string of commands

$@ from shell scripts returns the value of the shell parameter

if you are gdb-ing a project with multiple files, you can use "break : to specify which file at which line to break

ack-grep is a more powerful version of the grep program

scp is the secure copy over network program! useful

g++ compiler is more strict than windows nmake compiler, and will put each library being compiled into the same namespace, whereas in nmake it puts each library in its own separate namespace