1

I want to use Scriptreplay with multiple log/timing files located in the same Directory.

The script I have right now looks like this:

select timings in /mnt/home/$USER/shell_logs/*; 
do
clear
scriptreplay $timings 
done;;
esac

Is there a way to select two files (the log and the timingfile of that log) at the same time?

2 Answers 2

3

The easiest way is if you can get there from the filename. For instance, if the selected filename is /mnt/home/$USER/shell_logs/20140326.log, you could get to another file in the same directory with a different extension, or another file in another directory pretty easily.

Let's first look at stripping the extension off:

timings="/mnt/home/$USER/shell_logs/20140326.timing" # just for testing
log="${timings%%.*}.log"
echo $log

And here's how to strip the leading path to change to a different directory:

log="/mnt/home/$USER/timings/${timings##*/}"
0

OP wrote:

It works great!!!

select timings in /mnt/home/$USER/shell_logs/*.timing; 
do
log="${timings%%.*}.log"
  clear
  echo "${txtred}Script gestartet${txtrst}"
  scriptreplay $timings $log
  echo "${txtred}Script beendet${txtrst}"
done;;
esac

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .