LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.

Notices

Reply
 
Search this Thread
Old 03-08-2007, 07:12 PM   #1
UltraSoul
Member
 
Registered: Dec 2004
Location: Japan
Distribution: REDHAT9.0, Mandrake10.1
Posts: 404

Rep: Reputation: 31
sh script issue.


I am not sure whether I contact the correct forum. If not I will stop the query.

I have solaris 10 installed. I have a question about shell command execution.
I want to execute the read shell command in echo string as follows.

echo "input: `read input`"

But the command above failed to execute. I wonder how I do it?
 
Old 03-08-2007, 07:20 PM   #2
Blinker_Fluid
Member
 
Registered: Jul 2003
Location: Clinging to my guns and religion.
Posts: 682

Rep: Reputation: 63
simple script that shows syntax

#!/bin/sh
echo enter something
read INPUT
echo $INPUT


that's how I usually use read.
 
Old 03-08-2007, 08:20 PM   #3
UltraSoul
Member
 
Registered: Dec 2004
Location: Japan
Distribution: REDHAT9.0, Mandrake10.1
Posts: 404

Original Poster
Rep: Reputation: 31
#xcon
User ID: <<= I does not want the input line change into the next line.
Can you give me some ideas to modify the input format as "User ID: ryan"

ryan
passwd:


Best Regards.
 
Old 03-09-2007, 02:43 PM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,505

Rep: Reputation: 360Reputation: 360Reputation: 360Reputation: 360
I think this is what you are looking for:
Code:
printf "User ID: "
read uid
stty -echo
printf "Password: "
read password
stty echo
printf "userid=$uid, password: $password"
 
Old 03-29-2007, 04:31 PM   #5
wpn146
Member
 
Registered: Jan 2005
Distribution: Solaris, Linux Fedora Core 6
Posts: 170

Rep: Reputation: 30
Quote:
Originally Posted by UltraSoul
I am not sure whether I contact the correct forum. If not I will stop the query.

I have solaris 10 installed. I have a question about shell command execution.
I want to execute the read shell command in echo string as follows.

echo "input: `read input`"

But the command above failed to execute. I wonder how I do it?
I believe the backticked string is executed first, so your prompting "echo" will follow rather than lead the entry of input, and since a "read input" command doesn't return any text, your "Echo" prompt will become very confusing, asking for "input:" after the input has already been expected.

Try:
Code:
read input?"Enter Input:"
 
  


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
Simple script issue...I think chiquitomuir Linux - Newbie 4 09-22-2006 09:02 PM
Python Script Issue* Millenniumman Programming 1 06-18-2006 09:21 PM
Issue with my backup script gauge73 Linux - General 7 02-23-2004 07:54 PM
Script Issue gauge73 Linux - General 8 07-14-2003 08:50 AM
issue with shell script chupacabra Linux - General 3 10-18-2002 08:12 PM


All times are GMT -5. The time now is 04:41 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration