#! /bin/bash ## This shell script (1) remove the white space of all *jpg files in the present folder e.g., 'empirical potential*.jpg', ## into e.g., 'empiricalpotential*.jpg'. ## (2) Following that, the script remove the .jpg extension from all the 'empiricalpotential*.jpg'. ## (3) All 'empiricalpotential*' are then converted into 'empiricalpotential*.pdf' ## Essentiall, this script convert all *.jpg file into *.pdf, even if the *jpg files contain white space. ## After the shell, no more *.jpg remain. ## Strangely, this scrip will disappear from the current folder after the conversion. rename "s/ *//g" *.jpg #remove white space in file names rename 's/\.jpg$//' *.jpg #remove extention .jpg #for f in *; do # file=$(echo $f | tr ' ' _) # [ ! -f $file ] && mv "$f" $file #done for i in `ls *`; do convert -density 300 "$i" "$i".pdf; rm "$i"; done