0

Lets consider that the output of my every custom execution (some software in linux), gets saved in a generic filename /mydump/xyz.out. Instead of custom naming every output file, I want to write a script which does the following:-

  1. navigates to /mydump (cd mydump)
  2. creates a filename using arguments passed eg. config1_config2xconfig3.out
  3. renames xyz.out to config1_config2xconfig3.out (mv xyz.out "configbasedfilename")

For this what I understand is I should create some function in a script file, eg. custom_rename () and call it with config1-2-3 from the terminal whenever I wish to rename.

eg:- $custom_rename config1 config2 config3
or $ ./custom_rename.csh config1 config2 config3

or whatever makes sense.

  • 1
    Yes that's right, but I struggle to understand what your actual question is. – Andrew Richards Jan 28 '22 at 18:42
  • Welcome to Ask Ubuntu! I agree with @AndrewRichards here -- It's unclear given the way your post is worded exactly what question you have. Are you looking for assistance with a script? Simply validation that you are on the right track? The best way to do it? (Note, "best way" is off-topic as "Subjective"/"Opinion-based", though). Please edit your post to clarify your question. Thanks! – NotTheDr01ds Feb 03 '22 at 21:23

1 Answers1

1

You could write your own, probably limited script. Why not use "Bulk-rename" or similar packages, that are readily available?

[1]

There are more tools available. I wouldn't write anything myself...

kanehekili
  • 5,846
  • 1
  • 12
  • 32