Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
titleExample for using how to use sudo from a non-root account
linenumberstrue
sudo -su user1 <<EOF
whoami
pwd
EOF

...

Code Block
languagebash
titleExample for using how to use su from the root account
linenumberstrue
su -l user1 <<EOF
whoami
pwd
EOF

...

The Script Editor offers the folder icon to open the list of available Script Includes like this:


Users can navigate to select the desired Script Include:

...

Code Block
languagebash
titleExample for using how to use sudo from Script Includes
linenumberstrue
#!/bin/bash

##!include sudo-sos1
pwd
whoami
##!include sudo-end 

##!include sudo-sos2
pwd
whoami
##!include sudo-end 

...

A workflow can parameterize use of Script Includes in any of the included jobs like this:

  • The --replace argument name is used when calling the Script Include.
    • The first argument value specifies the search string in the Script Include.
    • The second argument value specifies the replacement string in the Script Include.

Code Block
languagebash
titleExample for using how to use sudo from Script Includes
linenumberstrue
#!/bin/bash

##!include sudo-begin --replace="<user>","sos1"
pwd
whoami
##!include sudo-end 

##!include sudo-begin --replace="<user>","sos2"
pwd
whoami
##!include sudo-end 

...