Last active
November 2, 2018 01:20
-
-
Save constrict0r/1978fbdae8c62b741fd010a5de8cd62d to your computer and use it in GitHub Desktop.
Create a function, export it and call it as another user.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USER=$1 | |
say_hello() { | |
printf 'hello' | |
} | |
export -f say_hello | |
su $USER -c say_hello | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment