Trying to determine what version is running so I can do an if/then statement in a bash script.

0 Comments   [ + ] Show Comments


Please log in to comment

Community Chosen Answer


On a Mac, it would be something like:  ps aux | grep AMPAgent

Edit:  Ok, try this from your home directory:

/Library/Application\ Support/Dell/KACE/bin/AMPAgent -v |grep version

Or numerals only:

/Library/Application\ Support/Dell/KACE/bin/AMPAgent -v |grep version|awk '{print $6}'
Answered 07/26/2012 by: jknox
Red Belt

  • That pulls the process id and everything. Is there a way to pull the version from it? It shows its location which I could use. 5.3 stores KBOX in one location, 5.1 in another. I could just say if its here, do this, if its there, do that.
  • Could you use something like:
    If Exist '5.3FolderName' Then
    Or whatever the Unix equivalent would be.
  • See above for edit.
    • That kinda did the trick. Here's the dilemma. Your solution works for 5.3 only. Version 5.1 has a different path: /Library/KBOXAgent/Home/bin/SMMPAgent. I will probably need to do an if statement and two variables to get it to work unless there's some common process that's running that I can grep the version from?
      • I'd just update the agents to 5.3 so they are all the same. If you have uploaded the 5.3 agent to the KBOX, you can do the following:

        Settings>K1000 Agent>Agent Updates from KACE>

        Click Edit Mode and check the box for Enabled.
  • I'm probably asking a little too much from the bash scripting in detecting the different agents and then running a script based on the version. But I did find a way to detect the version:

    # First see if the file exists
    if [ -e "/Library/Application Support/Dell/KACE/data/version" ]; then
    #Then get the version from the file
    agent1=$(head -n 1 "/Library/Application Support/Dell/KACE/data/version")

    echo $agent1
    # else do this and see if agent is ver 5.1

    elif [ -e "/Library/KBOXAgent/Home/version" ]; then

    agent2=$(head -n 1 "/Library/KBOXAgent/Home/version")
    echo $agent2

Please log in to comment



IF you are talking about Redhat agent then try


rpm -qa | grep amp


Answered 07/25/2012 by: AbhayR
Sixth Degree Black Belt

Please log in to comment
This content is currently hidden from public view.
Reason: Removed by user request
For more information, visit our FAQ's.

This content is currently hidden from public view.
Reason: Removed by user request
For more information, visit our FAQ's.


are you talking the client running on a machine or the kbox server's base OS?

Answered 07/25/2012 by: SMal.tmcc
Red Belt

  • Based on his earlier question I would say he is talking about the machine client.
  • she, but yes, machine client. sorry about not clarifying.
  • Ah, my apologies. In the IT world I tend to assume that... Probably a bad habit.
  • ;)
Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja