Search This Blog

Sunday, October 1, 2023

Shell script 10

Question:

How to check whether the file has read, write and execute permissions 

Answer:

 #!/usr/bin/bash

file=“/home/kalam/file.text”

## checking for write permissions 

if [ -r $file ]

then

echo “File has read access”

else

echo “File does not have read access”

fi

## checking for write permissions 

if [ -w $file ]

then

echo “File has write permission”

else

echo “File does not have write permission”

fi

## checking for execute permission 

if [ -x $file ]

then

echo “File has execute permissions”

else

echo “File does not have execute permission”

fi



No comments:

Post a Comment

What is the sanity checks you have done for STA?

 Sanity checks for STA: Linking Checks: We need to check., is there any missing modules or missing pins in a library. this is done by link c...