jenkins shell

通过man bash可知:

OPTIONS
       In  addition  to  the  single-character shell options documented in the description of the set builtin command,
       bash interprets the following options when it is invoked:

       -c string If the -c option is present, then commands are read from string.  If there are  arguments  after  the
                 string, they are assigned to the positional parameters, starting with $0.
       -i        If the -i option is present, the shell is interactive.
       -l        Make bash act as if it had been invoked as a login shell (see INVOCATION below).
       -r        If the -r option is present, the shell becomes restricted (see RESTRICTED SHELL below).
       -s        If  the  -s  option  is present, or if no arguments remain after option processing, then commands are
                read from the standard input.  This option allows the positional parameters to be set  when  invoking
                 an interactive shell.
       -D        A  list  of all double-quoted strings preceded by $ is printed on the standard output.  These are the
                 strings that are subject to language translation when the current locale is not  C  or  POSIX.   This
                 implies the -n option; no commands will be executed.

可以通过-i参数和-l参数让bash为login shell and interactive shell,就可以读取/etc/profile和~/.bash_profile等文件。

即在jenkins Execute Shell里可以这么写

#!/bin/bash -ilex
...

...

对于e参数表示一旦出错,就退出当前的shell,x参数表示可以显示所执行的每一条命令

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值