The tiny tool time everybody should know, measures execution time of a given command. For example:
prints time information to the console. But what if you want to collect these statistics in a file? Linux man page say “-o FILE” is the way to do so. This will look like
time -o file.log echo "test"
This FAILS not only on my machine with the error message “bash -o: unknown command” or equal. The key is to give the full path:
/usr/bin/time -o file.log echo "test"
The problem is, that “time” is used for different things. This leads to another cute tool called type. type gives information about the kind of a command.
type -a time
time is a shell keyword
time is /usr/bin/time
As you can see “time” not only means the command. If somebody knows more about the “Why the hell is this so?”, feel free to post
The tiny tool time everybody should know, measures execution time of a given command. For example:
time echo "test"
prints time information to the console. But what if you want to collect these statistics in a file? Linux man page say "-o FILE" is the way to do so. This will look like
time -o file.log echo ...
With this post I will start an article series about default options for popular shell tools. And I would like to invite all of you to participate in this process to find a profound default option set for these tools. I will provide my current DOS as a discussion base and extend these by user comments.
In this first DOS its all about GNU grep.
Overview:
Some fundamental information about the considered tool.
How to set default options:
This section will describe how to set the Default Option Set. For grep its the environmental variable GREP_OPTIONS.
Default Option Set:
In this section comes a descriptive list of the options.
- ignore binary files
--binary-files=without-match
- use colored output in terminals
- ignore special files like fifos, char and block devices
- exclude patch *.rej and *.orig files
- exclude common scm directories
- exclude build directories
Copy’n'Paste:
And here is a ready-to-use version of the option set.
export GREP_OPTIONS="--binary-files=without-match \
--color=auto \
--devices=skip \
--exclude='*.rej' \
--exclude='*.orig' \
--exclude-dir=.git \
--exclude-dir=.svn \
--exclude-dir=CVS \
--exclude-dir=patches \
--exclude-dir=.pc \
--exclude-dir=.libs \
--exclude-dir=.deps"
div.round {
border-style: hidden;
border-width: 1px;
-moz-border-radius: 4px;
background-color: #e3e3e3;
padding: 4px;
}
div.inside {
padding-left: 30px;
}
table.overview {
border-spacing: 0px;
border-style: hidden;
}
With this post I will start an article series about default ...
Recent Comments