help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] counter for executed commands in non interactive mode?


From: Meike Stone
Subject: Re: [Help-bash] counter for executed commands in non interactive mode?
Date: Mon, 18 May 2015 17:57:50 +0200

>> is there a easy way, to count inside a bash script the executed
>> (external) commands while this script itself is executed?
>> Normaly, the commands are counted in the interactive mode and
>> displayed in the command prompt if "\#" is configured.
>> Maybe, there is a possibility to access this counter?
>
> The shell attempts to count the number of commands executed, but it's
> not limited to external executed commands: it includes both compound
> and simple commands, including builtins and shell functions.  The \#
> prompt expansion is the only place where that count is exposed.

... but it is not possible to access this internal counter?

I like to use this only to optimize the scripts, because of using
"loops" inside ...
One option would be to use strace with filter ... but it wold be nicer to access
this values inside - and log this in a file only if needed!

Thanks Meike



reply via email to

[Prev in Thread] Current Thread [Next in Thread]