Quote:
|
I'm not trying to criticize
|
I didn't sense that at all.
I read every word like it's gold.
I
want my mistakes pointed out to me.
I'm wanting to learn how to get this job done,and if that's what it takes,criticize away.
You call it criticize,I call it help!
I'm not sure if I only posted the mistakes you noted here,or if I actually entered them in terminal also.
So I went back and made sure those mistakes weren't present.
Still no results at all.
I tried the command as you presented it,this is the result.
Code:
$ for FILE in /home/user/Desktop/test/*rename* ; do
> NEWNAME=${FILE##*_}
> echo $FILE will become $NEWNAME
> done
/home/user/Desktop/test/01-rename_a will become a
/home/user/Desktop/test/01-test_rename_a _rename_a will become a
/home/user/Desktop/test/02-rename_b will become b
/home/user/Desktop/test/02-test_rename_b will become b
/home/user/Desktop/test/03-rename_c will become c
/home/user/Desktop/test/03-test_rename_c will become c
The results of echo show that something will be done,although not what I wanted.
I only want the 01,02,03 etc. removed.
I entered the command as follows anyway,without echo,because this is only a test directory.
Code:
for FILE in /home/user/Desktop/test/*rename* ; do
> NEWNAME=${FILE##*_}
> done
Nothing happened at all.
This is ls after I entered the above command.
ls
01-rename_a/ 02-rename_b/ 03-rename_c/
01-test_rename_a _rename_a 02-test_rename_b 03-test_rename_c
01- trip.txt 02- trip.txt 03- trip.txt
I am surely confused now.
Why did echo say things would happen,then they never did?
As the above echo states,two files will become a,two files will become b,etc,
You can't have two files in the same directory with the same name,so maybe this is why "nothing happened"?
Feel very free to criticize!
