Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Create filetest.sh
  • Loading branch information
dx7er authored Sep 6, 2021
commit 04cf5bcd3e13c7612b02209739cbf56906247eba
17 changes: 17 additions & 0 deletions scripts/filetest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

echo -e "enter name of fole to check: \c"
read -r file_name

if [ -e "$file_name" ]; then
echo "$file_name found"
else
echo "$file_name not found"
fi

#Notes for file testing:
# -e is use to check file existence
# -d is used to check directory existence
# -f is used to check if file exists and if it is a regular file
# -s is used to check if file is empty or not
# -r for read permissions , -w for write permissions and -x for executable permissions.