Does control-C from console interrupt ash script execution?

Denis Vlasenko vda.linux at googlemail.com
Fri Jun 29 16:18:29 UTC 2007


On Wednesday 27 June 2007 17:35, Dallas Clement wrote:
> Hello All,
> 
> I am executing an ash init script from initramfs.  I have only the
> console for I/O at this time -- no TTYs available.
> 
> My init script prompts for input like so:
> 
>                printf " is that correct? (y|n) -> "
>                read confirm
> 
> Should I be able to interrupt ash script execution with a control-C?
> 
> I am trying to trap it in my script as follows:
> 
> trap abort 2

No, it won't work. Ctrl-C, Ctrl-Z etc have special
meaning only when they come from controlling tty.

/dev/console cannot be a controlling tty in Linux.
(there is code in kernel which disallows this).

See cttyhack (and its help text) in newer busybox.
--
vda



More information about the busybox mailing list