From 320e5a4dfd745d5a30c060e2a290e6822ae37787 Mon Sep 17 00:00:00 2001 From: Aadit Agrawal Date: Fri, 17 Jan 2025 09:25:11 +0530 Subject: [PATCH] Upload files to "OS/bash" --- OS/bash/q1.sh | 11 +++++++++++ OS/bash/q2.sh | 10 ++++++++++ 2 files changed, 21 insertions(+) create mode 100644 OS/bash/q1.sh create mode 100644 OS/bash/q2.sh diff --git a/OS/bash/q1.sh b/OS/bash/q1.sh new file mode 100644 index 0000000..e9c36c0 --- /dev/null +++ b/OS/bash/q1.sh @@ -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 diff --git a/OS/bash/q2.sh b/OS/bash/q2.sh new file mode 100644 index 0000000..a2c73c1 --- /dev/null +++ b/OS/bash/q2.sh @@ -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