Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kiruthiga #20

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions ex5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
read -p "Enter the file path" File_path
if [ -e "$File_path" ]&&[ -w "$File_path" ]; then
echo "File_path exists password are enabled"
if [ -w "$File_path" ];
then
echo "you have permission to edit "$File_path""
else
echo "you do not have a permission to edit "$File_path""
fi
else
echo "$File_path does not exist"
fi
6 changes: 6 additions & 0 deletions ex6.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
ANIMALS=("MAN" "BEAR" "PIG" "DOG" "SHEEP")
for ((i=0; i<=${#ANIMALS[@]}; i++))
do
echo "${ANIMALS[i]}"
done
6 changes: 6 additions & 0 deletions function_ex1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
file_count() {
count=$(ls)
echo "There are $count files in present working directory"
}
file_count
9 changes: 9 additions & 0 deletions wildcards_ex1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
TODAT=$(date +%Y-%m-%d)
for file in *.jpg;
do
if [ -f "$file" ]; then
mv "$file" "${TODAY}-${file}"
echo "Renamed $file to ${TOADY}-${file}"
fi
done