Upload files to "OS/bash"
This commit is contained in:
parent
4009ac5344
commit
320e5a4dfd
11
OS/bash/q1.sh
Normal file
11
OS/bash/q1.sh
Normal 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
10
OS/bash/q2.sh
Normal 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
|
Loading…
x
Reference in New Issue
Block a user