Skip to content

.bash_profile equivalent? #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ShimShamSam opened this issue Jan 9, 2014 · 6 comments
Closed

.bash_profile equivalent? #113

ShimShamSam opened this issue Jan 9, 2014 · 6 comments

Comments

@ShimShamSam
Copy link

MSysGit will read your ~/.bash_profile file and load various functions and aliases from it. Is there any way for Cmder to have this feature since it uses MSysGit?

@samvasko
Copy link
Contributor

samvasko commented Feb 1, 2014

  1. What would you suggest to add? We currently have windows native aliases.
  2. Can you provide relevant docs from msysgit?

Thanks

@ShimShamSam
Copy link
Author

.bash_profile allows you to create bash functions that can be called directly from the CLI. The key advantage of functions is that they can accept parameters.

For work, I often SSH into a set of specific servers. To make it easier, I create a single function called "s" that accepts a server name as an argument. The body of the function is a switch statement that maps the server name I passed in to an IP address or domain.

I can't seem to find any docs from MSysGit. I would imagine it is a straight copy from the bash implementation found here. .bash_profile is essentially just a file that gets run when the terminal starts. You may be able to just emulate the feature by running some file within the cmder directory.

Here is an easy way to demonstrate the feature.

  1. Open MSysGit (Git Bash)
  2. $ printf "function foo\n{\necho "Hello, $1"\n}\n" > ~/.bash_profile
  3. Restart MSysGit
  4. $ foo world

@samvasko
Copy link
Contributor

samvasko commented Feb 2, 2014

I think there is nothing like that for cmd.exe + msysgit.
But
I think it would be nice to also add git bash to cmder. So I will add that to the todo!

@surdy
Copy link

surdy commented Jun 6, 2014

@Knotix As a workaround, I edited my init.bat to launch bash, which launched the MSysGit bash and have a .bash_profile in my home directory, which is picked up by MSysGit bash

@denolfe
Copy link

denolfe commented Jul 7, 2014

@Knotix My workaround for this was to add the following lines to /vendor/msysgit/etc/profile

if [ -e $CMDER_ROOT/config/.bash_aliases ]; then
    . $CMDER_ROOT/config/.bash_aliases
fi

Then place all of my desired aliases in /config/.bash_aliases.

@Jackbennett
Copy link
Contributor

There's now a config/user-startup.cmd file created for this purpose as well as the already available powershell $profile areas to use. Should be available from the 1.3 release onwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants