The Archives

  • 23.Jan.09
    Space for shell | pfortuny | (5)
    So your friend sent you a batch of tiffs to be converted into jpg's (using ImageMagick's convert command). However your friend (who is not so geeky as you) uses spaces in filenames (which is a deadly sin), like in First photo of birthday.tiff Second photo.tiff You wanted to use a shell for loop, but the obvious $ for i in `find . -name *tiff` ; do convert "$i" "${i%tiff}jpg" ; done produces garbage (try it). This is just one of the consequences of your friend's carelessness. But there is a solution. IFS (Internal Field Separator) is a shell variable controlling what character(s) delimit a 'field' in ...