0

I use for loop to use specific tool with the set of files:

nohup sh -c 'for i in ~/files/*txt; do ID=`echo ${i} | sed 's/^.*\///'`; ./tool $i &&
mv output ${ID}.out; done' &

This tool has specific naming for outputted files and I want to rename the output as it would be overwritten and it is simpler for me.
However this specific mv doesn't work with nohup - files are not renamed individually and get overwritten.

How can I solve this problem.

pogibas
  • 27,303
  • 19
  • 84
  • 117

1 Answers1

1

Why the complicated nohup dance, and not just

for i in ~/files/*.txt; do
    ./tool $i && mv output `basename $i`.out
done
nneonneo
  • 171,345
  • 36
  • 312
  • 383