Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Bash script to append a .txt extension to a filename

Why?



And regardless of whether it's necessary in the first place, why is it a bash script rather than a sh script? Very few of these use bash-specific extensions, and the BSDs don't necessarily have bash installed.

Things like that make porting from Linux to BSD and other Unices tons of fun.


A more general case would be: How to change a pattern in a bunch of file names from X to Y:

  for i in *X*; do mv $i ${i/X/Y}; done


Or just use 'rename':

     $ rename s/foo$/bar/ *foo




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: