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