Force CVS repository to work "silently" all the time

1

When I use commands like cvs commit -m . I get rather annoying info that cvs is examining all directories. To avoid it I can use cvs -q commit -m . Can I do something so that cvs works silently for all operations without the option -q?

Soham Banerjee

Posted 2018-04-25T10:58:03.847

Reputation: 11

You can use an alias or a function for cvs, eg alias cvs=$(which cvs) -q or cvs() { $(which cvs) -q "$@"; } ; export cvs. An alias is valid for interactive commands in the current shell, while an exported function will work in subshells, including those created to run scripts. – AFH – 2018-04-25T11:16:15.940

Thanks for the hint, although I used alias cvs="cvs -q" instead of alias cvs=$(which cvs) -q as it threw error...thanks again – Soham Banerjee – 2018-04-25T11:30:58.657

Using which cvs forces reference to the real binary file, bypassing any internal definitions, such as an alias or function. This stops any possibility of recursion. – AFH – 2018-04-25T11:36:53.577

I have submitted an answer, so that others with a similar problem can see that there is a solution. – AFH – 2018-04-25T11:44:03.130

Answers

0

You can use an alias or a function for cvs, eg:

alias cvs="$(which cvs) -q"
cvs() { $(which cvs) -q "$@"; } ; export cvs

An alias is valid for interactive commands in the current shell, while an exported function will work in subshells, including those created to run scripts.

Using which cvs forces reference to the real binary file, bypassing any internal definitions, such as an alias or function. This stops any possibility of recursion. Note that using double quotes in the alias definition means that which cvs is called only once, when the alias is defined; single quotes would call which cvs whenever cvs is typed.

AFH

Posted 2018-04-25T10:58:03.847

Reputation: 15 470

But alias cvs=$(which cvs) -q throws error:- -bash: alias: -q: not found – Soham Banerjee – 2018-04-25T12:01:39.937

@SohamBanerjee - Sorry, missed quotes. – AFH – 2018-04-25T13:15:01.573