Skip to content
Snippets Groups Projects
Commit 6375f821 authored by ys554's avatar ys554
Browse files

lab3

parent fce022d7
Branches
No related tags found
No related merge requests found
#!/bin/bash
#Yegeon Seo
for file in *; do
if [ ! -d $file ]; then
echo -n $file ;wc -l -w < $file
fi
done
#!bin/bash
#Yegeon Seo
for file in *; do
echo "entering for loop"
extension="${file##*.}"
if [ "$extension" = "mp3" ]; then
artist="${file%-*}"
filename="${file%.*}"
song="${file##*- }" ; echo $song
if [ ! -d "$artist" ]; then
mkdir "$artist"
mv "$file" "$song"
mv "$song" "./$artist"
else
mv "$file" "$song"
mv "$song" "./$artist"
fi
fi
done
#!/bin/bash
#Yegeon Seo
if [ $# -lt 2 ]; then
echo "You need at least two arguments!" ; exit
elif [ -z $2 ]; then
echo "Not enough arguments!" ; exit
fi
for file in *; do
extension="${file##*.}"
filename="${file%.*}"
if [ $filename == $extension ]; then
if [ $1 == ${filename:(-1)} ]; then
mv $filename ${filename::-1}$2
fi
elif [ $1 == .$extension ]; then
mv $file $filename$2
fi
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment