I think you might need to iterate over the values in the array of directories. Something like:
for i in "${pdfFolders[@]}"
do
if [ -d $i ]
then
echo "Folder $i present"
else
echo "Not all folders are present...running policy to add"
jamf policy -event install-fmfolders
break
fi
done
Pretty sure the "$" needs to be left out when declaring the array as well:
pdfFolders=(...)
I think you might need to iterate over the values in the array of directories. Something like:
for i in "${pdfFolders[@]}"
do
if [ -d $i ]
then
echo "Folder $i present"
else
echo "Not all folders are present...running policy to add"
jamf policy -event install-fmfolders
break
fi
done
Pretty sure the "$" needs to be left out when declaring the array as well:
pdfFolders=(...)
Interesting. I'm confused now since I have other scripts that use $ after =. They work but this one won't. I will give this a try.
I think you might need to iterate over the values in the array of directories. Something like:
for i in "${pdfFolders[@]}"
do
if [ -d $i ]
then
echo "Folder $i present"
else
echo "Not all folders are present...running policy to add"
jamf policy -event install-fmfolders
break
fi
done
Pretty sure the "$" needs to be left out when declaring the array as well:
pdfFolders=(...)
This works! THANK YOU!!!
Of course now I have the mystery of why other scripts work that use $ after = but I will deal with that later 😊
This works! THANK YOU!!!
Of course now I have the mystery of why other scripts work that use $ after = but I will deal with that later 😊
@howie_isaacks You're probably getting confused with the difference between an array and a variable. A variable can either just be a string, such as:
somename="hello"
So when somename is called later it equals hello.
Or you can set a variable with the output of a command, such as:
somename=$(somecommand)
And somename then becomes the results of somecommand
With an array it just needs parens to enclose the contents. The $ is not valid for declaring a shell array.
somearray=(one two three)
With the above, when iterating over it, it will print out
one
two
three
Hope that helps clarify it a bit.
@howie_isaacks You're probably getting confused with the difference between an array and a variable. A variable can either just be a string, such as:
somename="hello"
So when somename is called later it equals hello.
Or you can set a variable with the output of a command, such as:
somename=$(somecommand)
And somename then becomes the results of somecommand
With an array it just needs parens to enclose the contents. The $ is not valid for declaring a shell array.
somearray=(one two three)
With the above, when iterating over it, it will print out
one
two
three
Hope that helps clarify it a bit.
Thanks! I remember that.... now 😎 I appreciate all the help!