简体   繁体   中英

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. Is it possible? I have tried using expand_aliases option as well but not luck. I am running my jenkins from custom workspace ie /Users/user1.

Here is the output of jenkins console.`Started by user admin Building in workspace /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'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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