Do bash run the command right after it starts, and then stay in this session?

I need to run the command right after bash starts, and then stay in the session. I was expecting something like this to work bash && cd ~/Work , but apparently the second command will be executed in the first session, and not the one I'm running.

I found this bash command in a new shell and remain in the new shell after running this command , but running bash --rcfile does not work for me, because I still need rcfile to load.

+4
source share
1 answer

You can still use --rcfile , you just need to include the default rc file source in your command list:

 bash --rcfile <(echo ". ~/.bashrc && cd ~/Work") 
+5
source

Source: https://habr.com/ru/post/1389998/


All Articles