简体   繁体   English

无法在Jenkins构建中使用.bash_profile的别名

[英]Unable to use alias of .bash_profile in Jenkins build

I have installed Jenkins on MAC and I am trying to use alias created on my MAC ~/.bash_profile in jenkin build. 我已经在MAC上安装了Jenkins,并且尝试使用在jenkin构建中在我的MAC〜/ .bash_profile中创建的别名。 Is it possible? 可能吗? I have tried using expand_aliases option as well but not luck. 我也尝试过使用expand_aliases选项,但是没有运气。 I am running my jenkins from custom workspace ie /Users/user1. 我正在从自定义工作区即/ Users / user1运行我的詹金斯。

Here is the output of jenkins console.`Started by user admin Building in workspace /Users/user1 这是jenkins控制台的输出。`由用户admin启动在工作区/ Users / user1中构建

[user1] $ /bin/bash -xe /var/folders/55/fxxv86j970zcdv3gs27z4flm0000gp/T/jenkins2742750483712853243.sh
+ cd /Users/user1
+ pwd
/Users/user1
+ env
+ grep -i shell
SHELL=/bin/bash
+ source /Users/user1/.bash_profile


++ alias 'l=ls -lasrt'

+ l
/var/folders/55/fxxv86j970zcdv3gs27z4flm0000gp/T/jenkins2770891577912812441.sh: line 8: l: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
`

You're doing a big mistake. 您犯了一个大错误。 Don't add quotes like that. 不要像这样添加引号。

alias 'l=ls -lasrt' is wrong. 

Right: This will work 正确:这可以工作

alias l='ls -lasrt' is right
alias ll='ls -alF'
alias la='ls -A'
alias lx='ls -CF'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM