Needing a hint. Creating that function called Meter my simple script works well. What I want now is to start the last four commented lines to include or trigger a reaction, if there are more than n lines in that .txt-file it shall display that message for example. But the interpreter says there is a syntax-error. Any hints? Thanks in advance!
#!/bin/bash
# name of the script is line3.sh
set -e
set -u
echo $0
Meter ()
{
Zet=$(wc -l /home/$USER/Desktop/14tilt.txt)
Ted=$(wc -c /home/$USER/Desktop/14tilt.txt)
}
Meter
echo "lines" $Zet | cut -d '/' -f1 &&
echo "bytes" $Ted | cut -d '/' -f1;
#if [ $Zet -gt 400 ]
# then echo "did it"
# else echo "not yet"
#fi;
exit 0;
But I am sure that this specific textfile contains more than 400 lines. So what can I do?
Best solution was "<" for directing the input and making obsolete by this the cut-statement. Before doing so the interpreter was mourning about a missing definition of the /home-folder. BTW thanks to Don Cragun as well, for the hint with "bash -xv name-of-the-script.sh", that is reeeeaallllyy good. It told me the steps after the correction.