Posted on 08-05-2010 12:15 AM
I'm trying to create an Extension Attribute that can look for the existence of a directory named "Test" in a known path. I do an Advanced search, selecting the Extension Attribute and entering "is = Yes"...or entering "is = No"...but the search comes up dry. I manually confirmed that the /Users/Shared/test directory exists on one computer, but does not exist on the other.
Here's what I have...any ideas how I can get this to work?
Data Type = String Input Type = Populated by Script Script: #!/bin/bash directory="/Users/Shared/test" if [ -d $directory ]; then echo "<result>Yes</result>" else echo "<result>No</result>" fi
Thanks,
Don
Posted on 08-05-2010 12:19 AM
If you are checking to see if it exists, why not use the exist flag in the
On Thu, Aug 5, 2010 at 2:15 PM, Don Montalvo <donmontalvo at gmail.com> wrote:
If statement:
#!/bin/bash directory="/Users/Shared/test" if [ -e $directory ]; then echo "<result>Yes</result>" else echo "<result>No</result>" fi
Posted on 08-05-2010 01:16 PM
Either would work, I'm just used to using "-d" when looking for directories.
Tried it with "-e" without luck.
Don
Posted on 09-02-2010 11:48 AM
Don,
I know I am a little late on this, just saw it. I just tried it and it
worked for me. If you already have it figured out, then just disregard,
otherwise let me know if it worked for you.
Sean
#!/bin/sh
#To check for presence of "test" directory in the Users/Shared location
#Check to see if Absolute call in
if [ -d "/Users/Shared/test" ]; then
result="Yes"
echo "<result>$result</result>"
else
echo "<result>No</result>"
fi
Posted on 09-02-2010 02:40 PM
Hi Sean,
Interesting! I'm going to give this another try.
I really want to be able to use Extension Attributes, specifically to check for proper install and running process on some agents we're deploying (to start). :)
Thanks,
Don