2

I have some installation instructions but they use pathmunge which caused me an error in Ubuntu. What is the equivalent syntax to the following script to do the same in Ubuntu?

/etc/profile.d/openssl.sh
pathmunge /usr/local/openssl/bin

I did add pathmunge command to Ubuntu using this answer:

run nano ~/.bashrc && source ~/.bashrc and paste this:

pathmunge () {
        if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
           if [ "$2" = "after" ] ; then
              PATH=$PATH:$1
           else
              PATH=$1:$PATH
           fi
        fi
}

When I login, I get this error:

error loading /etc/profile.d/openssh.sh

muru
  • 207,228

1 Answers1

2

Apparently in RHEL and CentOS, pathmunge is a shell function declared in /etc/profile (source). You can simply add that very same function to your /etc/profile or ~/.bashrc (which needs to be sourced after you add the function).

For simplicity, run nano ~/.bashrc && source ~/.bashrc and paste this:

pathmunge () {
        if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
           if [ "$2" = "after" ] ; then
              PATH=$PATH:$1
           else
              PATH=$1:$PATH
           fi
        fi
}

Save the file after pasting with Ctrl+o (that's lowercase o, not zero), and exit with Ctrl+x. The command will be available for use after that.

Alternatively, you can just add directory to PATH by hand, temporarily as in PATH=$PATH:/usr/local/openssl/bin , or permanently as provided in How to add a directory to the PATH? by modifying /etc/profile (global for all users) or better by modifying ~/.bashrc file if you just need this for your user.