Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Hi I am curious if it is possible to execute a bash script inside bash rc. It would seem to create a infinite loop unless there was some way to tell it to not try and start a new shell.

Here is an example

bash_script.sh:

#!/bin/bash
echo Hello World

.bashrc

export HELLO_WORLD=$(bash_script.sh)    
share|improve this question
add comment

1 Answer

Ok I figured out how to do this. In .bashrc just do:

export HELLO_WORLD=$(source bash_script.sh)
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.