I am writing a very simple script which copies a file to a path provided by the user as a parameter and I would like to make sure the path starts with /var/log/messages.
So I've written this:
if [[ $2 -ne /var/log/messages/* ]]
then
echo "Incorrect path, must be under /var/log/messages/"
exit
fi
But it doesn't seem to work.
What am I doing wrong?
[[ $2 != /var/log/messages/* ]](incorrect path)-neis for arithmetic comparisons.