Score:0

command to keep only the name of a file

in flag

is there any command in linux to keep only the name of a file without its extension I am creating a backup of txt files, when I generate the files with a script the extension is .txt.bkp and I only want the extension .bkp

file=$1
cat $file > $file.fasta 
Score:2
cn flag

This bash expansion will do it: ${file%.*}.

María José avatar
in flag
thank you I have already solved my doubt but thank you very much.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.