问题
I'm getting error while executing my shell script
alias abs='~/local/bin/abs'
echo $(which abs)
source /home/rundeck/.bashrc # included alias abs as well. I'm just sourcing it twice.
python batch_update_autobuilds.py <- I'm getting an error here
($which abs)
prints,,,
alias abs='~/local/bin/abs'
~/local/bin/abs
batch_update_autobuilds.py source code (Where the error is coming from)
abscommand = "abs update --test" // --test tag has been recently updated.
commandline = subprocess.Popen((abscommand))
output, error = commandline.communicate()
if error: <- error got caught here. //So it says no option available for --test.
Problem:
- Somehow when I call the bash execution command
commandline.communicate()
, it calls the oldabs
which doesn't have--test
option.
Possible Solution(need help):
- I copied
abs
execution file to~/local/bin
and I want to force python execution to use theabs
in~/local/bin
; alias didn't work in this case.
来源:https://stackoverflow.com/questions/56878854/alias-doesnt-affect-python-execution-environment-in-bash