Issue
I want to run below gnuplot command to generate graph from gpl file.
gnuplot gplfile0.gpl
gnuplot gplfile1.gpl
gnuplot gplfile2.gpl
gnuplot gplfile3.gpl
gnuplot gplfile4.gpl
gnuplot gplfile5.gpl
gnuplot gplfile6.gpl
..
..
..
..
I have a parent gplfile.gpl
which help to generate all require gplfile*.gpl
with unique content. I don't want to remove or move or delete parent file form given folder.
I have written a bash shell script to run above commands.
run_script.sh :
#!/bin/bash
echo "Generating the images using gnu plot"
date
shopt -s extglob
rm -rf *.png
for f in *gpl
do
gnuplot $f
done
I am able to generate output from all gplfile*.gpl
file. But I want to exclude parent gplfile.gpl
from running .
How I can exclude running parent gplfile.gpl
file from the bash shell script.
Is there any command in the bash shell script to exclude the specific file from run.
Solution
Since you have extglob
on then.
for file in !(gplfile).gpl; do echo gnuplot "$file"; done
Answered By - Jetchisel Answer Checked By - Candace Johnson (WPSolving Volunteer)