Below is my ksh shell script where I need to check if variable fileprops is a subset of $1 argument.
echo "FILE PROPERTY: $fileprops"
echo "PARAMETER3: $1"
if [ "$1" == *"$fileprops"* ]; then
echo "We are Good. $line FILE is found to be INTACT !! "
else
echo "Problem on Target Server !! The file $line WAS TAMPERED. Exiting..."
exit 1;
fi
I was expecting the condition to pass but it fails. See output below where fileprops is actually a subset of $1.
FILE PROPERTY:
-rwxrwxrwx user1 2019-08-31 17:36 /fin/app/01/scripts/filename6.src 4294967295
PARAMETER1:
10.7.44.37\\n-rwxrwxrwx user1 2019-08-31 17:36 /fin/app/01/scripts/filename6.src 4294967295\\n-rw-rw-r-- user1 2019-08-30 17:31 /fin/app/01/sql/33211.sql 4294967295\\n10.7.44.34\\n-rwxrwxrwx user1 2019-08-31 17:36 /fin/app/01/scripts/filename6.src 4294967295\\n-rw-rw-r-- user1 2019-08-30 17:31 /fin/app/01/sql/33211.sql 4294967295
Output:
Problem on Target Server !! The file /fin/app/01/scripts/filename6.src WAS TAMPERED. Exiting...
Note: parameter1 is passed in single quotes and this is required.
Can you please suggest