12 lines
293 B
Plaintext
12 lines
293 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
export IFS="
|
||
|
"
|
||
|
export prefix="$(echo $PWD | rev | cut -f 1 -d '/' | rev)"
|
||
|
firstext="$(ls | head -n 1 | rev | cut -f 1 -d \. | rev)"
|
||
|
export count=1;
|
||
|
for i in $(ls -tr *."$firstext" | grep -v "$prefix"); do
|
||
|
mv "$i" "$prefix $count.$firstext"
|
||
|
export count=$(($count+1))
|
||
|
done
|