I have a shell script:
#!/bin/bash
for name in /home/imp/imp/msgs/$1.PK1; do
mv "$name" "${name%.PK1}.BRD" 2>/dev/null >/dev/null
done
for name in /home/imp/imp/msgs/$1.PK2; do
mv "$name" "${name%.PK2}.MIX" 2>/dev/null >/dev/null
done
It works, but only on pre-existing files. What happens, is that more *.PK1 and *.PK2 are created after the initial scan. I'd like this script to "loop"
and rename the files that are created afterwards. Is this possible?
UPDATE:
This is what I have now:
#!/bin/bash
while [ ! -z "$(ls *.PK1 *.PK2 2>/dev/null)" ]; do
for name in /home/imp/imp/msgs/$1.PK1; do
mv "$name" "${name%.PK1}.BRD" 2>/dev/null >/dev/null
done
for name in /home/imp/imp/msgs/$1.PK2; do
mv "$name" "${name%.PK2}.MIX" 2>/dev/null >/dev/null
done
sleep 1; done
Is that correct?
Thanks.