Hi Gurus,
Does anyone know to use a sudo in an if condition ? Can you tell me if the first one will work or the second one. What happens if there are multiple lines in the if condition ??
Thanks a lot
sudo -u auser if [[ ! -d "mappedfolder/subfolder" ]]; then
sudo -u auser echo "mappedfolder is not mapped for user"
sudo -u auser fi
sudo -u auser if [[ ! -d "mappedfolder/subfolder" ]]; then
echo "mappedfolder is not mapped for user"
fi
Does anyone know to use a sudo in an if condition ? Can you tell me if the first one will work or the second one. What happens if there are multiple lines in the if condition ??
Thanks a lot
sudo -u auser if [[ ! -d "mappedfolder/subfolder" ]]; then
sudo -u auser echo "mappedfolder is not mapped for user"
sudo -u auser fi
sudo -u auser if [[ ! -d "mappedfolder/subfolder" ]]; then
echo "mappedfolder is not mapped for user"
fi