hacking bash

hacking bash

Post by Eric Smi » Mon, 26 Apr 1999 04:00:00



Hi

I am continually adding alias commands to my default profile file.
Oftentimes I am in a bash instance that has not sourced the profile file
since the particular alias that I am trying to run has been added.

Now, is it possible to hack the bash - perhaps the source to instruct it
that whenever it cannot find a command it must `. profilefile', then try
the command again?

--
Eric Smith

Tel. 021 236 111

 
 
 

hacking bash

Post by DanH » Mon, 26 Apr 1999 04:00:00



> Hi

> I am continually adding alias commands to my default profile file.
> Oftentimes I am in a bash instance that has not sourced the profile file
> since the particular alias that I am trying to run has been added.

> Now, is it possible to hack the bash - perhaps the source to instruct it
> that whenever it cannot find a command it must `. profilefile', then try
> the command again?

Well, after you update your .bashrc why don't you 'source ~/.bashrc' and
let the changes take effect.

Dan
--
UNIX - Not just for vestal *s anymore
Linux - Choice of a GNU generation

 
 
 

hacking bash

Post by Vladimir Solona » Wed, 28 Apr 1999 04:00:00


create ".bash_profile" file in home directory and
write any config option hire.

 ---------------------------------------------
|>-----------------Zloj Vlad-----------------<|

 =============================================

Quote:>I am continually adding alias commands to my default profile file.
>Oftentimes I am in a bash instance that has not sourced the profile file
>since the particular alias that I am trying to run has been added.

>Now, is it possible to hack the bash - perhaps the source to instruct it
>that whenever it cannot find a command it must `. profilefile', then try
>the command again?

 
 
 

hacking bash

Post by Kenny McCorma » Wed, 05 May 1999 04:00:00



...

Quote:>>I am continually adding alias commands to my default profile file.
>>Oftentimes I am in a bash instance that has not sourced the profile file
>>since the particular alias that I am trying to run has been added.

>>Now, is it possible to hack the bash - perhaps the source to instruct it
>>that whenever it cannot find a command it must `. profilefile', then try
>>the command again?

As expected, several of the posters have misunderstood what you meant.

You are looking for something like in TCL and, I think, Lisp, where
the system (i.e., interpreter) will automatically try to look up
unknown procedures for you, at runtime, on an as-needed basis.
As far as I know, no shells do this.

To answer your question, sure, I'm sure you could hack bash to add
this feature.  You will probably have to figure out on your own how to
do it though - I doubt anyone on the newsgroup is going to want to do
it for you.

 
 
 

hacking bash

Post by Alex V Snasti » Fri, 07 May 1999 04:00:00


Hi.

> Date: Tue, 04 May 99 12:28:43 -0500 in  comp.unix.shell


> Subject: [News] Re: hacking bash


> ...
> >>I am continually adding alias commands to my default profile file.
> >>Oftentimes I am in a bash instance that has not sourced the profile file
> >>since the particular alias that I am trying to run has been added.

> >>Now, is it possible to hack the bash - perhaps the source to instruct it
> >>that whenever it cannot find a command it must `. profilefile', then try
> >>the command again?

> As expected, several of the posters have misunderstood what you meant.

> You are looking for something like in TCL and, I think, Lisp, where
> the system (i.e., interpreter) will automatically try to look up
> unknown procedures for you, at runtime, on an as-needed basis.
> As far as I know, no shells do this.

> To answer your question, sure, I'm sure you could hack bash to add
> this feature.  You will probably have to figure out on your own how to
> do it though - I doubt anyone on the newsgroup is going to want to do
> it for you.

No need hack the bash... :)

For bash (exclusively):
Put your alias commands in $HOME/.bashrc

.bashrc will be starting every time when new copy of bash start
and aliases will be stilling workable.

I often use this feature of bash (e.g. after run Midnight Commander
my aliases still work).

--
Bye.
Alex.

 
 
 

hacking bash

Post by Kenny McCorma » Fri, 07 May 1999 04:00:00





>> ...
>> >>I am continually adding alias commands to my default profile file.
>> >>Oftentimes I am in a bash instance that has not sourced the profile file
>> >>since the particular alias that I am trying to run has been added.

>> >>Now, is it possible to hack the bash - perhaps the source to instruct it
>> >>that whenever it cannot find a command it must `. profilefile', then try
>> >>the command again?

>> As expected, several of the posters have misunderstood what you meant.

>> You are looking for something like in TCL and, I think, Lisp, where
>> the system (i.e., interpreter) will automatically try to look up
>> unknown procedures for you, at runtime, on an as-needed basis.
>> As far as I know, no shells do this.

>> To answer your question, sure, I'm sure you could hack bash to add
>> this feature.  You will probably have to figure out on your own how to
>> do it though - I doubt anyone on the newsgroup is going to want to do
>> it for you.

>No need hack the bash... :)

>For bash (exclusively):
>Put your alias commands in $HOME/.bashrc

>.bashrc will be starting every time when new copy of bash start
>and aliases will be stilling workable.

No, you still don't get it.

The idea is that you've got shells laying around (say, a bunch of open
xterms) and you edit your aliases file (.bashrc or whatever).  You
want everythng to be automatically updated, *without* having to do any
of the following:

        1) Logout and log back in
        2) Close and re-open each of the shells
        3) Type a command to "re-source" the .bashrc or whatever file
           (in each shell)

The idea is that it should be "perfect save" - that is, the moment the
change is made in the master file, the properties of all open
objects (instances) should be immediately and automatically updated.

Its tough to do within the basic paradigm of Unix.  But it is a neat
idea...

Note that something like the "unknown_command" hook in TCL would
handle the case of a newly defined alias, but wouldn't handle
redefinition of an existing alias.

 
 
 

hacking bash

Post by Ken Pizzi » Sat, 08 May 1999 04:00:00


On 6 May 1999 23:44:46 -0500,



>>> >>I am continually adding alias commands to my default profile file.
>>> >>Oftentimes I am in a bash instance that has not sourced the profile file
>>> >>since the particular alias that I am trying to run has been added.

>>> >>Now, is it possible to hack the bash - perhaps the source to instruct it
>>> >>that whenever it cannot find a command it must `. profilefile', then try
>>> >>the command again?
...
>The idea is that you've got shells laying around (say, a bunch of open
>xterms) and you edit your aliases file (.bashrc or whatever).  You
>want everythng to be automatically updated, *without* having to do any
>of the following:

>    1) Logout and log back in
>    2) Close and re-open each of the shells
>    3) Type a command to "re-source" the .bashrc or whatever file
>       (in each shell)

>The idea is that it should be "perfect save" - that is, the moment the
>change is made in the master file, the properties of all open
>objects (instances) should be immediately and automatically updated.

>Its tough to do within the basic paradigm of Unix.  But it is a neat
>idea...

How about this solution:
  PROMPT_COMMAND=". ~/.bashrc"

Not quite immediate (won't happen until the next time the shell
displays a prompt), and for large/complex .bashrc files it can
be a bit of a resource hog, but perhaps it is close enough or
a helpful starting point?

                --Ken Pizzini

 
 
 

1. hacking bash to source conditionally

Hi

I am continually adding alias commands to my default profile file.
Oftentimes I am in a bash instance that has not sourced the profile file
since the particular alias that I am trying to run has been added.

Now, is it possible to hack the bash - perhaps the source to instruct it
that whenever it cannot find a command it must `. profilefile', then try
the command again?

--
Eric Smith

Tel. 021 236 111

2. mailserver

3. BASH BASH BASH BASH BASH BASH BASH BASH BASH BASH

4. glibc pointer trash

5. associative array hack for bash

6. DOSEMU emumod: Symbols don't match?

7. Bashing bash (Was Re: bash or user error with set -e and subshells)

8. Databases with ODBC

9. Bash calls TCL, TCL calls Bash, 2nd Bash never reads input

10. Bash/CGI - - HTML call to Bash script

11. difference in behaviour of bash-2.0 from bash-1.14.7

12. (patch for Bash) Bash with embedded Python

13. co-processes and bash (ksh does it, can bash?)