FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora User

 
 
LinkBack Thread Tools
 
Old 10-03-2011, 01:21 AM
Christopher Svanefalk
 
Default Nifty bash trick?

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?
--
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
 
Old 10-03-2011, 01:21 AM
Christopher Svanefalk
 
Default Nifty bash trick?

(That should be a ! at the end, typo)

On Mon, Oct 3, 2011 at 3:21 AM, 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?
>
--
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
 
Old 10-03-2011, 03:02 AM
"T.C. Hollingsworth"
 
Default Nifty bash trick?

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
 
Old 10-03-2011, 02:13 PM
Christopher Svanefalk
 
Default Nifty bash trick?

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
 

Thread Tools




All times are GMT. The time now is 11:14 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org