Tiny Core Linux

Tiny Core Base => TCB Talk => Topic started by: nim108 on July 19, 2012, 10:35:33 AM

Title: bootlocal.sh not processing "read" prompts
Post by: nim108 on July 19, 2012, 10:35:33 AM
I am launching an external shell script through bootlocal.sh (i.e. sudo sh /home/tc/test.sh, same result with sudo /home/tc/test.sh) which has a read in it to prompt the user for some input:

read -n1 -r -p "Press any key to continue..."
echo ""

However, bootlocal.sh nor any script I run from it pauses at all, it just runs through the whole script as if there were no "read" in there. I should add that if I run this script manually once TC is up through the terminal (I am not using any X extensions, this is plain core), it works fine and prompts for user input. Am I not running this correctly? Is bootlocal.sh supposed to autorun through everything?
Title: Re: bootlocal.sh not processing "read" prompts
Post by: curaga on July 19, 2012, 12:12:50 PM
bootlocal is backgrounded. For interactive/sync use, use bootsync.sh.
Title: Re: bootlocal.sh not processing "read" prompts
Post by: coreplayer2 on July 19, 2012, 07:44:09 PM
Jeez!! now you tell me...   :P
Title: Re: bootlocal.sh not processing "read" prompts
Post by: coreplayer2 on July 19, 2012, 08:01:00 PM
Ok taking the OP's question one step further...  how about running two scripts, the first is not interactive but must complete prior to the second script which is interactive.?


bootsync.sh

/path/first_scrip.sh;
/path/second_script.sh


Perhaps?
Title: Re: bootlocal.sh not processing "read" prompts
Post by: nim108 on July 20, 2012, 05:14:42 AM
As always, thank you curaga, that was simple enough ... coreplayer, I had no idea either  :-\
Title: Re: bootlocal.sh not processing "read" prompts
Post by: coreplayer2 on July 20, 2012, 04:45:33 PM
I hear you, I would never have guessed running in asynchronous mode would cause the script to run like that.   Learn something new every day around here..
Title: Re: bootlocal.sh not processing "read" prompts
Post by: curaga on July 22, 2012, 09:08:57 AM
Quote
Ok taking the OP's question one step further...  how about running two scripts, the first is not interactive but must complete prior to the second script which is interactive.?

Yes, that way works. The ';' is unneeded there, but doesn't hurt.

BTW, this is commented on top of both bootlocal and bootsync files, IIRC ("use this file for asynchronous use", "use this file for sync use" or equivalent). Patches welcome if the comments weren't descriptive enough ;)
Title: Re: bootlocal.sh not processing "read" prompts
Post by: coreplayer2 on July 22, 2012, 08:13:26 PM
Thanks Curaga

I think the commented instructions (well there are some...) relating to synchronous must have gotten relocated to /dev/null at some point in history.. :(

though bootSYNC is kind of a clue..   I just never put the two meanings together doh!