0

I'm switching over to zsh from bash, but as I'm getting used to everything, is there a way to run a single command with a shell other than my default shell, so I can maintain my normal workflow? Ideally, I would like bash to maintain the environment of my config files.

Say I have some alias which is only in my bash aliases:

I want to do something like this

bash <some bash command>

I tried hacking a script:

~/bin/mybash

#!/bin/bash

source ~/.bashrc

$@

% ~/bin/mybash which <my bash alias> <- no success

1 Answer 1

3
bash -ic 'some bash command'

will run some bash command in a bash shell that is initialized in a similar way as an interactive shell (including loading ~/.bashrc and permitting expansion of aliases).

Ex.

 % echo $0
zsh

 % type ls
ls is /bin/ls

 % bash -ic 'type ls'
ls is aliased to `ls --color=auto'
1
  • exactly what I was looking for. Thanks!
    – alrob
    Aug 23, 2020 at 5:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .