Find the answer to your Linux question:
Results 1 to 3 of 3
Hello, Not sure if the title is appropriate, but here is what I would like to do: script running in terminal pauses and waits for user input. user is able ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2007
    Posts
    19

    script change keyboard mapping?


    Hello,

    Not sure if the title is appropriate, but here is what I would like to do:

    script running in terminal pauses and waits for user input.

    user is able to input strings with linebreaks, ie, types a line, hit return, types another line, return, and as he is doing this, the lines appear on the screen like they would in an editor:

    line 1
    line 2
    line 3
    ...

    presses some other key (combination) to send the input to the script.

    Is this possible? I have been looking into stty, but my experiments haven't come up with anything useful. Maybe some utility like tput, except for tty?

    Thanks,

    Allasso

  2. #2
    Just Joined!
    Join Date
    Jan 2007
    Posts
    19
    in perl:

    #!/usr/bin/perl

    use strict;

    my @userinput = <STDIN>;
    foreach (@userinput) { print; }

    wonder if there's a way in bash?

  3. #3
    Linux Newbie
    Join Date
    Apr 2010
    Location
    Novosibirsk, Russia
    Posts
    145
    I suppose, you could just read line by line using `read`command and check if string contains some special character, using `grep`

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •