Once I get this bit working, I'll then be able to integrate this into my forked copy of cPInstall that I linked to earlier in this post. derptest.sh: line 39: ` then `apt-get update -y`'Īs far as I can tell, the code looks exactly the same and should work but I may or may not be wrong. derptest.sh: line 39: syntax error near unexpected token `then' Let's move on."Įcho -e "$OK You're running on `arch` with $OS $ENDC"Įcho -e "$FAIL We could not update! $ENDC"Įcho -e "$OK OS update completed. Ver=`cat /etc/lsb-release | awk /'ID=*/' | cut -d "=" -f 2`Įcho -e " $FAIL Your System is Not Supported $ENDC "Įcho -e " $OK We've determined the OS. Naturally, in this case, I want the Bash script to automatically install the appropriate version of Webmin, e.g: rpm version of Webmin and deb version of same to be installed based on the OS and package manager that the script detects.Įcho -e " $OK Beginning OS detection. For example, let's say I want to copy bits that build on the cPanel installation snippet from cPInstall and modify it to use for Webmin. The goal is to reduce the amount of duplicate code that I need to write for various things.
Naturally this means I'll need to use yum $whatever $programhere. For example, let's say I've got CentOS installed.
#How to close a port in bash on mac how to#
However, what doesn't work is how to use that information to do some automated tasks. The OS detection bit works, at least, insofar as I can tell. Mostly because I'm working on figuring out how to make this work before I publish my script(s) to the world. Right now, my forked code is on GitHub and has been set to private. So, context: The bash script I'm writing is a fork of cPInstall. I imagine I'll be coming back here fairly often whilst trying to understand how to make this script work.
Alright, so I've been working on writing a script in Bash.