Unix/Linux Go Back    


UNIX for Dummies Questions & Answers This forum is closed for new posts. Please post beginner questions to learn unix and learn linux in this forum UNIX for Beginners Questions & Answers

What is the significance of sh -s in ssh -qtt ${user}@${host} "sh -s "${version}"" < test.sh?

UNIX for Dummies Questions & Answers


 
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 08-15-2013
Sree10 Sree10 is offline
Registered User
 
Join Date: Aug 2013
Last Activity: 4 December 2013, 10:13 PM EST
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
What is the significance of sh -s in ssh -qtt ${user}@${host} "sh -s "${version}"" < test.sh?

Please can you help me understand the significance of providing arguments under sh -s in

Code:
> ssh -qtt ${user}@${host} "sh -s "${version}"" < test.sh


Last edited by Franklin52; 08-16-2013 at 03:21 AM.. Reason: Please use code tags
Sponsored Links
    #2  
Old Unix and Linux 08-15-2013
neutronscott's Unix or Linux Image
neutronscott neutronscott is offline Forum Advisor  
script kiddie
 
Join Date: Jun 2011
Last Activity: 27 October 2016, 11:56 AM EDT
Location: South Carolina, USA
Posts: 936
Thanks: 30
Thanked 300 Times in 279 Posts
it'd be used by test.sh. similar to if you were to do, ./test.sh "$version"
Sponsored Links
    #3  
Old Unix and Linux 08-15-2013
Sree10 Sree10 is offline
Registered User
 
Join Date: Aug 2013
Last Activity: 4 December 2013, 10:13 PM EST
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
Thanks!, but please can you explain me how exactly that happens with


Code:
ssh -qtt $user@$host "sh -s "$version"" < test.sh

and not with


Code:
ssh -qtt $user@$host  < "test.sh "$version""

    #4  
Old Unix and Linux 08-15-2013
gacanepa gacanepa is offline
Registered User
 
Join Date: Jun 2013
Last Activity: 12 May 2016, 2:15 PM EDT
Location: Villa Mercedes, San Luis, Argentina
Posts: 174
Thanks: 22
Thanked 26 Times in 22 Posts
From man sh:

Code:
-s stdin         Read commands from standard input (set automatically if no file arguments are present).

Also, check this link and the examples provided therein: Bourne Shell shell-session option
Sponsored Links
    #5  
Old Unix and Linux 08-16-2013
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 7 December 2016, 7:02 AM EST
Location: Aachen, Germany
Posts: 9,923
Thanks: 200
Thanked 2,951 Times in 2,752 Posts
Quote:
Originally Posted by Sree10 View Post
Thanks!, but please can you explain me how exactly that happens with


Code:
ssh -qtt $user@$host "sh -s "$version"" < test.sh

and not with


Code:
ssh -qtt $user@$host  < "test.sh "$version""

If you run your second ssh command, sh (or better: that user's default shell from /etc/passwd) is implicitely run on the remote system, test.sh being fed into stdin. No process/command invocation - no parameters.
In the first version, you explicitely invoke sh and thus can supply parameters; the -s option tells it to then read commands from stdin. (actually, I'm not sure if two shs run, one default shell which then invokes sh with options and parameters)
Sponsored Links
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
awk command to replace ";" with "|" and ""|" at diferent places in line of file shis100 Shell Programming and Scripting 7 03-16-2011 09:59 AM
"pconsole" and "esaadmin" on AIX version 6 ebab3 AIX 1 05-08-2009 05:12 AM
significance of "+" char in SunOS "ls -l" output sayeo Solaris 6 02-28-2009 05:12 AM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-20-2007 01:52 AM



All times are GMT -4. The time now is 10:22 AM.