Standard streams

Thumbnail

bash debug – log all executed commands

2014/02/03

Whenever I am writing a script in perl or bash, I always wish that there was some way to have all the commands logged or output to screen. I know there is “set -x” option to have debugging enabled, …

vim maps – simple commands to do stuff.

2013/08/28

Some time back, I was working on some script for logging and I wanted to change the class to function like this: $logger->Debug("Test string"); loggerFunc("Debug", "Test String"); As you can see, …

convert tabs to spaces, the easy way

2013/07/08

Lots of times you want to convert tabs to spaces and sometimes from a shell script, if that is the case, then simple solution is “tidy“. First you need to install tidy as follows: sudo yum install …

Compare files excluding certain lines.

2011/10/18

Quick tip, you can use any expression for the sed commands in the (). With this trick you can redirect the stdout of 2 commands to the diff command. This might become very useful, if you want to …

faster bash operations on files with File Descriptors.

2011/06/11

I was writing a bash script that would do some operations and read and write to file. Seems that that was pretty simple with […] <td> <div class="text codecolorer"> while …

Terminating a SSH session after starting background process.

2011/05/14

 This is too good. If you are planning to start a background process in the bash script in the background and continue in the script, you cannot do it until……. You would need to close the stdout/stdin …

write the output of a command to /var/log/user.log… each line will contain $USER, making this easy to grep for.

2010/12/28

write the output of a command to /var/log/user.log… each line will contain $USER, making this easy to grep for. […] <td> <div class="text codecolorer"> &nbsp;log() { …

intercept stdout/stderr of another process or disowned process

2010/11/23

The command is definately going to save your day if you have disowned the process by mistake. Only uses strace so might as well work on Solaris also, though not tried it. intercept stdout/stderr of …

tee to a file descriptor

2010/08/13

tee to a file descriptor […] 1 $ tee >(cat &#8211; >&2) the tee command does fine with file names, but not so much with file descriptors, such as &2. This uses process …

coproc help - a new feature in bash

2010/05/10

In the <a class="zem_slink freebase/en/bash" title="Bash" rel="homepage" href="http://tiswww.case.edu/php/chet/bash/bashtop.html">bash version 4.0, there …

prepend to a file with sponge from moreutils

2010/03/16

<a href="http://bashcurescancer.com/prepend-to-a-file-with-sponge-from-moreutils.html">A few weeks I wrote about a tool, which helps you easily prepend to a file. I submitted prepend …


This website uses cookies to ensure you get the best experience on our website. Learn more Got it