help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Changing working directory for bashrc file


From: Chet Ramey
Subject: Re: [Help-bash] Changing working directory for bashrc file
Date: Fri, 25 Apr 2014 14:12:04 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

On 4/25/14, 11:06 AM, Rob Anderson wrote:

> I am contacting you regarding changing the working directory of the bashrc 
> file for the bash-4.1 binary I hope to include in an Android ROM. I have so 
> far successfully compiled the actual binary, however I would like the bashrc 
> file to be located at /system/etc/bash/bashrc (like CyanogenMod) rather than 
> the default location of ~/.bashrc. Could you please advise me as to whether 
> this is possible and, if it is, how I would go about achieving this?

I'm going to assume that you want to change the default location of the
startup file, since bash already allows you to specify an alternate file
with command line options.

Changing the default startup file is easy, but it depends on how much
source code editing you want to do.  If you are ok with modifying source
(and I imagine you are, given the scope of your project), take a look at
shell.c:

194:static char *bashrc_file = "~/.bashrc";
1768:  bashrc_file = "~/.bashrc";

Modify these two lines to contain the pathname you want and recompile.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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