[SOLVED] getting the filename without the extinsion in bash?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
getting the filename without the extinsion in bash?
echo "You just heard, $(cat ~/lastauto)"
lastfm="You just heard, $(cat ~/lastauto)"
function play ()
for file in ~/Downloads/*.mp3; do
#file2 = echo "$(basename $file)"
echo "You just heard: $(cat ~/lastauto). You are listening to O-W-E-N. Next up, we have: $file . Lets go!"
espeak "You just heard, $(cat ~/lastauto). You are listening to O-W-E-N, Next up, we have, $file . Lets go!" 2>/dev/null
I want to get the filename without the extension. ($file2 is marked out to remind me to fix it.)
The script is a mp3 player that tells me what just played and whats next, so i dont have to look.
Right now, it tells me what the song is, but says "dot mp3" after the file.
And, I cant ever get the basename. Any suggestions?
(I just started learning Bash earlier this week. and i made the script. the entire thing, so i didnt steal. >.<)
Deletes shortest match of $substring from back of $string.
Deletes longest match of $substring from back of $string.
Deletes shortest match of $substring from front of $string
Deletes longest match of $substring from front of $string.
"Easier to remember" is relative to your experience. Use the substitutions long enough and they become pretty much second nature, just like any other skillset. They aren't really that difficult to remember anyway, at least not the ones you'll use most often. There are actually only about 8 main patterns, and logical variations thereof. And the references are always at hand when you need them.