I have absolutly no scripting experience, so this may be a stupid question, but I am trying to figure out how to get the result of a command and use it in another command. I don’t want to complicate you with my real script so lets say for instance I wanted to get the computer name and ping it. I put together the following which i know is pretty wrong since it doesn’t work. I just want to know how to do it correctly. Any help would be greatly appreciated.
sudo -S scutil –get LocalHostName
echo $lpassword |
read COMPUTERID
echo “The computer name should show below”
echo $odcompname
ping $odcompname
My ultimate goal is I want to get the computer name and insert the computer name in another command to join my clients to OD.