fedora-users October 2011 archive
Main Archive Page > Month Archives  > fedora-users archives
fedora-users: Re: Nifty bash trick?

Re: Nifty bash trick?

From: Christopher Svanefalk <christopher.svanefalk_at_nospam>
Date: Mon Oct 03 2011 - 14:13:23 GMT
To: Community support for Fedora users <users@lists.fedoraproject.org>

Thanks mate!

On Mon, Oct 3, 2011 at 5:02 AM, T.C. Hollingsworth
<tchollingsworth@gmail.com> wrote:
> On Sun, Oct 2, 2011 at 6:21 PM, Christopher Svanefalk
> <christopher.svanefalk@gmail.com> wrote:
>> Quick question, what do I add to what config file to make bash run
>> 'clear' prior to executing whatever commands I run in the terminal?
>> Thanks in advance?
>
> Add this to your ~/.bashrc:
>
>
> preexec () { clear; }
> preexec_invoke_exec () {
>    [ -n "$COMP_LINE" ] && return  # do nothing if completing
>    local this_command=`history 1 | sed -e "s/^[ ]*[0-9]*[ ]*//g"`;
>    preexec "$this_command"
> }
> trap 'preexec_invoke_exec' DEBUG
>
>
> Tip of the hat to:
> http://superuser.com/questions/175799/does-bash-have-a-hook-that-is-run-before-executing-a-command/175802#175802
>
> -T.C.
> --
> users mailing list
> users@lists.fedoraproject.org
> To unsubscribe or change subscription options:
> https://admin.fedoraproject.org/mailman/listinfo/users
> Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
>
-- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines