How to store in a variable an echo | cut result?

bash, linux, shell, string

Solution

FILE=$(echo "filename.pdf" | cut -d'.' -f 1)

Problem

for example ``` echo "filename.pdf" | cut -d'.' -f 1 ``` This way I get the "filename" string. I'd like to store it in a variable called FILE and then use it like this: ``` DIR=$PATH/$FILE.txt ``` So, my script wants to create a file.txt with the same name of the pdf (not a copy of the file, just the name) This way I tried to assign the result of echo | cut ``` FILE= ``` but I get only "path/.txt" so the filename is missing.

Original source