Unix/Linux Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

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

UNIX for Dummies Questions & Answers


Closed Linux or Unix Question    
 
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 02: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 May 2015, 9:48 PM EDT
Location: South Carolina, USA
Posts: 868
Thanks: 29
Thanked 266 Times in 252 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: 25 May 2015, 8:08 PM EDT
Location: Villa Mercedes, San Luis, Argentina
Posts: 171
Thanks: 22
Thanked 25 Times in 21 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 Advisor  
Registered User
 
Join Date: Jul 2012
Last Activity: 28 May 2015, 2:21 AM EDT
Location: Aachen, Germany
Posts: 5,975
Thanks: 106
Thanked 1,604 Times in 1,507 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 sh s run, one default shell which then invokes sh with options and parameters)
Sponsored Links
Closed Linux or Unix Question

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 08:59 AM
"pconsole" and "esaadmin" on AIX version 6 ebab3 AIX 1 05-08-2009 04:12 AM
significance of "+" char in SunOS "ls -l" output sayeo Solaris 6 02-28-2009 04:12 AM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-20-2007 12:52 AM



All times are GMT -4. The time now is 03:51 AM.