Nothing happend what i could see-
Code:echo -n "say y: "; A=$(head -n1); echo $A say y: y root@R9000:/$
Say y: y
Answer: y
read -r -p 'Say y: ' A; echo "Answer: $A"
read -r -p 'Say y: ' A>/dev/null; echo "Answer: $A"
echo -n 'Say y: '; A=$(head -c1); echo "Answer: $A"
root@R7800:/$ type read
read is a shell builtin
This is such a struggle, .
R7800 and R9000 are so different here.
root@R9000:/$ read -r -p 'Say y: ' A; echo "Answer: $A"
Say y: y
Answer:
root@R9000:/$ y
/bin/ash: y: not found
read -r -p 'Say y: ' A>/dev/null; echo "Answer: $A"
Say y: y
Answer:
root@R9000:/$ y
/bin/ash: y: not found
echo -n 'Say y: '; A=$(head -c1); echo "Answer: $A"
Say y: y
Answer:
root@R9000:/$
Strange!Actually the R7800 behaves the same as the R9000.
Maybe you are not aware of some entware or busybox fix you have.
Code:root@R7800:/$ type read read is a shell builtin
This behaviour is from stock and has been as long as I have coded the R7800.
It also persisted when Voxel updated to latest greatest build-chain.
I had to use a /dev/tty trick to get it working as I wanted.
PS
I'm not at home and can not post my solution. But I'm sure @Voxel have one too!
root@HERMES:~$ /bin/busybox ash
BusyBox v1.4.2 (2020-04-22 16:03:24 UTC) Built-in shell (ash)
Enter 'help' for a list of built-in commands.
root@HERMES:~$ read A; echo $A
test
test
root@HERMES:~$ stty -a
speed 38400 baud; rows 18; columns 113; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>;
start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc
stty at
Dont be sorry I think this is fun just send whatever pops up in your mind.
Code:root@R9000:/$ stty at /bin/ash: stty: not found root@R9000:/$
stty -a
type test
Strange!
Apparently, other users of R7800 are not experiencing this problem!??
But as you pointed out, read is directly in ash, and I tried this:
I have installed no fixes on the rootfs, certainly not changed busybox ash...Code:root@HERMES:~$ /bin/busybox ash BusyBox v1.4.2 (2020-04-22 16:03:24 UTC) Built-in shell (ash) Enter 'help' for a list of built-in commands. root@HERMES:~$ read A; echo $A test test
So what is going on here?
test is a command, thats why it seems to be working. You should answer with y or n
Your code reads a command and then (tries to) execute it.
Code:type test
root@HERMES:~$ /bin/busybox ash
BusyBox v1.4.2 (2020-04-22 16:03:24 UTC) Built-in shell (ash)
Enter 'help' for a list of built-in commands.
root@HERMES:~$ read A
gheuhfehf
root@HERMES:~$ echo $A
gheuhfehf
root@HERMES:~$
type read
Maybe with stty?
Mine is:
Code:root@HERMES:~$ stty -a speed 38400 baud; rows 18; columns 113; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc
Yep:I remember the R7800 doesn't have "stty".
Again, I think your entware or something else is playing you tricks.
Did you run
Code:type read
root@HERMES:~$ type read
read is a shell builtin
R. Gerrits Dont mention entware! That "#"#¤ almost made me throw the router in the wall last night when i tried to get it working but could not do it
That is probably the case, but I don’t see how... This is very tricky...Again, I think your entware or something else is playing you tricks.
find / -name tty
find / -name stty
PSstty is only on entware, thats why KW gets the not found error.
I know stty is part of kwilt. Entware not needed... I used it before.
Can you run these commands:
Code:find / -name tty find / -name stty
PS
Don't mention I used kwilt to Voxel
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!