Hello,
I open a new POST, i consider that this is resolved
But i wish improve it.
In case 1, I would like to test the input file $1.
If $1 exist with no parameters but only comments, then send a message "Please..."
I tried somethings but no results.
Can you help me ?
#!/bin/bash
# set -vx
f1() {
echo $1 $2 $3 $4
}
case $# in
0) echo -e "# comment1\n# comment2" > list_file
read -p "Please fill in this list_file: "
echo $REPLY
;;
1) [ -f "$1" ] || exit
grep -v '^#' "$1" |
while read arg1 arg2 arg3 arg4
do f1 $arg1 $arg2 $arg3 $arg4
done
;;
4) echo -e "# comment1\n# comment2" > list_file
echo $1 $2 $3 $4 >> list_file
;;
5) echo -e "# comment1\n# comment2" > $1
f1 $2 $3 $4 $5 >> "$1"
;;
*) echo "error msg"; exit
esac
Have a nice day.