Upload files to "OS/bash"

This commit is contained in:
Aadit Agrawal 2025-01-17 09:25:11 +05:30
parent 4009ac5344
commit 320e5a4dfd
2 changed files with 21 additions and 0 deletions

11
OS/bash/q1.sh Normal file
View File

@ -0,0 +1,11 @@
#!/bin/bash
echo "Enter the name of item to be checked"
read name
if [ -f $name ]; then
echo "File $name exists"
elif [ -d $name ]; then
echo "Directory $name exists"
else
echo "Neither file or directory"
fi

10
OS/bash/q2.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/sh
echo "Which folder would you like to check?"
read folder
echo "Enter pattern/filename string to match"
read string
x=`find $folder -type f -iname "*$string*"`
for i in $x;do
echo "$i"
done