running terminal with script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting running terminal with script
# 1  
Old 12-12-2008
running terminal with script

suppose we have a file
ab
81


and another file
exec < $1
while read line
do
ssh root@172.16.1.$line
done

while running the command
sh file.sh ab

output display as shown

Pseudo-terminal will not be allocated because stdin is not a terminal.
root@172.16.1.81's password:
after writinfg password but it will not run.........


Why is is so that.......????
# 2  
Old 12-12-2008
Your
Code:
exec <$1

redirects all script input from whatever $1 is. Thus, any programs started by this script will also be redirected to whatever $1 is. Your starting ssh in interactive mode, which shouldn't take input from a non-terminal.

You don't need this exec line:
Code:
cat $1 |
while read line 
do
ssh ....
done

Or maybe you want to use ssh to execute a command and not run interactively. Is that the case?
# 3  
Old 12-12-2008
Quote:
Originally Posted by otheus
Your
Code:
exec <$1

redirects all script input from whatever $1 is. Thus, any programs started by this script will also be redirected to whatever $1 is. Your starting ssh in interactive mode, which shouldn't take input from a non-terminal.

You don't need this exec line:
Code:
cat $1 |
while read line 
do
ssh ....
done

Or maybe you want to use ssh to execute a command and not run interactively. Is that the case?
Still after running the command this dispalys
Pseudo-terminal will not be allocated because stdin is not a terminal.

Yes that is the case want to execute a command and not running interactively.
# 4  
Old 12-13-2008
Right. So run ssh with the command:
Code:
ssh user@foreign.host  command

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Terminal running bash/rsync script does not close with exit (MacOS High SIerra)

Hello, I am running a bash script to do an rsync back on a computer running MacOS High Sierra. This is the script I am using, #!/bin/bash # main backup location, trailing slash included backup_loc="/Volumes/Archive_Volume/00_macos_backup/" # generic backup function function backup {... (12 Replies)
Discussion started by: LMHmedchem
12 Replies

2. Solaris

Job Run Slower using Autosys than running through terminal

Hi All, We run Many jobs evryday using Autosys. Sometimes due to various reason we got to run the job from terminal as well (using nohup). We observed that the job running through terminal(nohup) takes much less time then the autosys (for same job). What can be the possible reason for such... (1 Reply)
Discussion started by: kg_gaurav
1 Replies

3. Shell Programming and Scripting

Running shell script in Cygwin terminal

I am new to shell scripting. I tried to run a simple shell script using Cygwin terminal in Win XP env. The script I have written is as follows - #!/bin/bash a=5 ] && echo "true" || echo "false" But when I execute the script, getting some confusing error. The error I am getting are - ... (3 Replies)
Discussion started by: linux_learner
3 Replies

4. Shell Programming and Scripting

script does not close terminal after running

For a small script i want it so that the terminal closes when the script has completed its tasks. To do so i use at the end if the script the following: echo "Hello, World!" echo "Knowledge is power." echo "" echo "shutting down terminal in 10 seconds" exit 10 however the terminal stay's... (3 Replies)
Discussion started by: Ditzyken
3 Replies

5. OS X (Apple)

[Solved] Running shell code in AppleScript without Terminal

What I want my script to do is to run a command in Terminal and close that same Terminal window when the process is complete. Of course I could ad a delay of 6 seconds to complete the process, but it may not be enough every time. To simplify my question, this is what I want to achieve.... (9 Replies)
Discussion started by: ShadowofLight
9 Replies

6. UNIX for Dummies Questions & Answers

Problems running script on remote Terminal

Hi, I'm new here so please excuse any stupidity that occurs in my post :P My situation: Have a java program which I have to run a ridiculous amount of times and put the output data into a text file. Thought the easiest way to do this would be to delve into the world of scripts. I am at home... (1 Reply)
Discussion started by: lozyness
1 Replies

7. Windows & DOS: Issues & Discussions

Display running 'app' in terminal titlebar?

Hi. I was, not too long ago, an OS X home user. One of the things I remember from using the Apple-installed Terminal is: whenever an executable that took more than a split second to do its thing was running, its name would appear in the title bar in a way similar to "Terminal: ssh" or "Terminal:... (0 Replies)
Discussion started by: SilversleevesX
0 Replies

8. Shell Programming and Scripting

Running a script without a terminal session

I'm trying to figure out how I can run a script "myScript.sh" in such a way that if my remote network connection gets disconnected, the script doesn't stop functioning. Right now I log in, run "./myScript.sh" and watch my output get pumped to a log file for about 10 hours. Only problem is that... (3 Replies)
Discussion started by: jjinno
3 Replies

9. Shell Programming and Scripting

Finding The Number Of Programs That A Given User Running On A TERMINAL

How To Find The Number Of Programs That A User Running ON A GIVEN TERMINAL (4 Replies)
Discussion started by: venkata.ganesh
4 Replies

10. UNIX for Dummies Questions & Answers

Running Terminal and/or X-Windows in Mac OS X

Quick question: When I load up Terminal or X-Windows on my Mac, and the prompt comes up...what folder am I starting in? (2 Replies)
Discussion started by: liquidcross
2 Replies
Login or Register to Ask a Question