AFP548 Changing the world one server at a time.

Script help – getting the output of a command and using it in another command

Home › Forums › OS X Server and Client Discussion › Questions and Answers › Script help – getting the output of a command and using it in another command

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #374072
    mjudson
    Participant

    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.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.