bash - loop; passing two argument - 1:1 mapping -


if have 50 different files rename (or anything, 2 arguments). how loop or other method ?

mv $1 $2 

i dont want pass argument each instance. $1 = ab , $2 = 1. 50 differnt filenames.

say have list of txt files in current directory want rename:

for f in *.txt; mv "$f" "renamed_$f"; done 

i suggest adding echo after see how command execute first, , removing echo if looks good.

for common file renaming tasks might want consider using mmv allows pattern-based file renaming more easily.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -