Search This Blog

Saturday, September 30, 2023

Shell script 4

Question:
Write a script whether the provided path type is file or dir

 #!/usr/bin/bash

#this script is for command line arguments

path=$1

if [ -f $path ]

then

        echo "the provided path type is file, you can read the content in any editor"

else

        if [ -d $path]

        then

        echo "the provided path type is not a file ,it is a Dir"

        fi

fi


Output :

the provided path type is file, you can read the content in any editor


Note;

-f  checks for file type

-d checks for directory 

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...