Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google site



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-15-2006
Registered User
 

Join Date: Nov 2006
Posts: 2
reading command output from shell script

Hi List,

How to read the output of a command executed from a script.
For ex.
sample_scritp.sh
-------------
useradd testuser1
password testuser1
....
.....
--------------
This prompts for "password", and "confirm password", for which i need to give the values from script.

Can anyone pls suggest a way to do this.

Thanks in advance
Sponsored Links
  #2 (permalink)  
Old 11-15-2006
blowtorch's Avatar
AFK
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,351
You will have to use the 'expect' utility for this. You cannot redirect input to the passwd command afaik.
  #3 (permalink)  
Old 11-15-2006
Registered User
 

Join Date: Nov 2006
Posts: 2
Smile Re:reading command output from shell script

Okey.
Can Shell script directly call Expect code?i.e can we write Expect code as part of the Shell script or we need write it in a seperate file and execute it.
Pls suggest some links for expect.

Regards,
Sri
  #4 (permalink)  
Old 11-16-2006
blowtorch's Avatar
AFK
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,351
Here you go: google search for 'man expect'.
  #5 (permalink)  
Old 11-16-2006
Registered User
 

Join Date: Nov 2006
Posts: 1
Unhappy My script doesn't work in hyper terminal

Hi All,
I am just learning shell scripting. I have a simple script (test.sh)
# !/bin/sh
echo "Enter your name"
read name
echo "Your name is $name"

in linux terminal I do
echo Tony | ./test.sh

then it prints out "Your name is Tony"

but when I run it through hyperterminal (that I connected from WinXP machine) then it doesn't work.
I'd like to have your help.
Thanks
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
reading XML datas via Shell Script freepal Shell Programming and Scripting 1 02-08-2008 11:52 AM
Reading the output of df command nervous UNIX for Dummies Questions & Answers 7 08-05-2007 01:53 PM
Q: Recording shell script screen output using "script" command ? lalfonso.gomez Shell Programming and Scripting 4 01-18-2007 09:31 PM
Reading a table in a shell script luiscarvalheiro Shell Programming and Scripting 13 08-10-2006 07:16 PM
Capturing shell script command output designflaw Shell Programming and Scripting 2 03-01-2006 04:24 PM



All times are GMT -4. The time now is 07:29 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2010. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0