forked from nsu-syspro/mpt-bash-basics-2024
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Marina Rudometova
committed
Sep 30, 2024
1 parent
b21d215
commit 1aa7b06
Showing
1 changed file
with
13 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
#!/bin/bash | ||
|
||
suffix=$1 | ||
extention=$2 | ||
suffix='' | ||
|
||
#for filename in *.*; do | ||
if [ ${filename##*/} -eq $extention ] then | ||
mv -v "$filename" "$filename$suffix" | ||
fi | ||
#done | ||
for opt in $@ | ||
do | ||
echo "suffix is $suffix" | ||
if [[ ! -n "$suffix" ]]; then | ||
suffix="$opt" | ||
echo "suffix assigned to be $suffix" | ||
else | ||
echo "will move $opt to $opt$suffix" | ||
mv "$opt" "$opt$suffix" | ||
echo "move done" | ||
fi | ||
done |