I am trying to create a script that renames all of my files within a directory hence the $( ls . ); by appending an incrementing number to the filename.
This is my script.
#!/bin/bash
# exercise 2
file_name=f
number=i
combined=$file_name" "$number
for f in $( ls . ); do
echo $f
done
for i in {i=1; i=`expr $i + 1`}; do
echo $combined
done
Although when I try running it with sh ex2.
It gives me a Syntax Error of
sh ex2
ex1
ex2
script01
script02
script03
script04
script05
script06
12: Syntax error: word unexpected (expecting "do")