[clug] .bash_aliases and .bashrc

Scott Ferguson scott.ferguson.clug at gmail.com
Sat Oct 18 20:36:13 MDT 2014

On 19/10/14 13:58, Francis Whittle wrote:
> On Sat, 2014-10-18 at 21:22 +1100, Scott Ferguson wrote:
>> function pause(){ echo "Press the Any key to continue..." read -p
>> "$*" }
> Humour about "the Any key" aside,

I'm sorry that bothers you.

> surely this should make the current terminal wait for a signal?

I don't understand your question? (I'm a bit thick)

Yes - the pause function makes the terminal wait for a *key-press*
signal, by design.

Is that what you mean?

I use it to test commands I intend to string together on the cli  i.e.
it enables me to see the output of the previous command without losing
any variable created by it (the previous command) while still retaining
the ability to continue with the next command (by pressing a key). Where
the cli command is complexly nested I prefer to string the individual
commands (;) and separate with pause before taking a plunge (or adding
more commands that will fail because their inputs were unexpected).
Sort, cut, and awk processing commonly.

In a script I'd use:-
trap "echo hit return;read x" DEBUG
to step through every line, or the pause function (added to the script)
to selectively "pause".

Kind regards

More information about the linux mailing list