当前位置:网站首页>How to set an alias inside a bash shell script so that is it visible from the outside?

How to set an alias inside a bash shell script so that is it visible from the outside?

2022-07-06 01:54:00 French red wine sweet

problem :

OSX: This works from the command line:OSX: This can work from the command line :

alias ruby="/opt/local/bin/ruby1.9"

but in side a shell script, it has no effect. But in shell Script , It has no effect .I want to write a script that will switch between ruby 1.8 and ruby 1.9, so this needs to be a script - not in my profile. I want to write a ruby 1.8 and ruby 1.9 Switch between scripts , So this needs to be a script - Not in my profile .

It appears "source script.sh" works, but "./script.sh". look “source script.sh” It works , however “./script.sh”.Why is this? Why is that ?How can I replicate this in my script? How can I copy this in the script ?


Solution :

Reference resources : https://stackoom.com/en/question/9Dev
原网站

版权声明
本文为[French red wine sweet]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140101444453.html