WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: bash script does not return to prompt  (Read 4310 times)

Offline ttz

  • Jr. Member
  • **
  • Posts: 82
bash script does not return to prompt
« on: September 24, 2015, 02:41:41 PM »
Code: [Select]
> more pm
#!/bin/bash
#find ~/music/|sort -R|head -n 30|xargs aplay
list=$(find ~/music/|sort -R|head -n 30)
echo $list | fold -s > pl;
echo $list|xargs aplay -q -c 5;
printf "PM IS DONE\n";
exit 0;

it is intended to be the most stupid-simple music player. problem is that when it is done, i don't have a clean return to prompt; have to press enter to get new prompt.

it is about a year-and-half old and does everything i want except end well. if i can fix that, then done!

how to fix?


Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: bash script does not return to prompt
« Reply #1 on: September 24, 2015, 05:04:13 PM »
Usually that means something wrote over your prompt.
What happens if you run ls instead of hitting the return key?
If 'ls' is run, then it is an overwritten prompt.

Offline ttz

  • Jr. Member
  • **
  • Posts: 82
Re: bash script does not return to prompt
« Reply #2 on: September 24, 2015, 05:43:29 PM »
@gerald_clark
ur right, ls gave me what ls gives plus new prompt. now what?

Offline ttz

  • Jr. Member
  • **
  • Posts: 82
Re: bash script does not return to prompt
« Reply #3 on: September 24, 2015, 06:09:11 PM »
oh, now don't i feel foolish! the whole of my prob was wrong expectation. i changed script so that

Code: [Select]
printf "PM IS DONE\n";
does not have '\n'

now i see it! i had my prompt the whole time!!!!!!!!

gotta laugh...

thanks for humoring me.