Function works, trigger causes syntax error, whats my fault??

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?

What output are you getting when you run your shell script?
What output do you get running the command:

wc /home/$USER/Desktop/14tilt.txt

when you run it in your shell interactively?

Have you tried running your shell script like this?:

bash -xv line3.sh

Does the trace it provides give you any indication of what is wrong?

1 Like

Try:

Zet=$(wc -l < /home/$USER/Desktop/14tilt.txt)
Ted=$(wc -c < /home/$USER/Desktop/14tilt.txt)

Then you should not need the cut commands either...

2 Likes

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.