LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 07-02-2018, 01:16 PM   #1
RalfR7
LQ Newbie
 
Registered: Jul 2018
Posts: 3

Rep: Reputation: Disabled
using read for multi line input


How can I get read to limit the number of characters it takes in from stdin for multiple lines
 
Old 07-02-2018, 01:58 PM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 9,396
Blog Entries: 7

Rep: Reputation: 2332Reputation: 2332Reputation: 2332Reputation: 2332Reputation: 2332Reputation: 2332Reputation: 2332Reputation: 2332Reputation: 2332Reputation: 2332Reputation: 2332
read is usually a shell builtin.
i use bash, and iwould enter 'help read' in a terminal.
i promise, it will help.
 
1 members found this post helpful.
Old 07-02-2018, 02:00 PM   #3
RalfR7
LQ Newbie
 
Registered: Jul 2018
Posts: 3

Original Poster
Rep: Reputation: Disabled
need to stay in ksh
 
Old 07-02-2018, 02:28 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 20,550

Rep: Reputation: 5037Reputation: 5037Reputation: 5037Reputation: 5037Reputation: 5037Reputation: 5037Reputation: 5037Reputation: 5037Reputation: 5037Reputation: 5037Reputation: 5037
Quote:
Originally Posted by RalfR7 View Post
How can I get read to limit the number of characters it takes in from stdin for multiple lines
..and....
Quote:
Originally Posted by RalfR7
need to stay in ksh
Ok, so now that we know you want to stay in KSH, post what YOU have written/done/tried, and tell us where you're stuck. Past that, you need to read the LQ Rules and the "Question Guidelines" link in my posting signature. We're happy to help you, but there are LOTS of sample scripts and examples you can find by doing your own research FIRST, before posting. Don't ask us to look things up for you.
 
Old 07-02-2018, 02:33 PM   #5
RalfR7
LQ Newbie
 
Registered: Jul 2018
Posts: 3

Original Poster
Rep: Reputation: Disabled
Something similar to this

echo -n "enter something "
read -n 20 st

The user will be putting a long statement of 2 -4 lines and I need to capture everything inputted as 1 variable, while automatically going to the next line after 60 characters so the lines will be consistent. Using -n 20 variable cuts off after the 1st line
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] awk/se: splitting a multi-line input at a regular expression and rearranging sarenace Programming 9 11-27-2012 09:00 AM
[SOLVED] Read Each Line of a File as Input roololing Programming 7 06-22-2011 03:33 PM
how to read input line by line (awk) slcalice Programming 4 03-09-2009 02:12 PM
Bash multi-line input won't wrap correctly spiffytech Linux - Software 2 03-28-2006 05:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 02:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration