What is the significance of sh -s in ssh -qtt ${user}@${host} "sh -s "${version}"" < test.sh? | Unix Linux Forums | UNIX for Dummies Questions & Answers

  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 Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 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 08-15-2013
neutronscott's Avatar
neutronscott neutronscott is offline Forum Advisor  
script kiddie
 
Join Date: Jun 2011
Last Activity: 18 April 2014, 2:16 PM EDT
Location: McMurdo Station, Antarctica
Posts: 745
Thanks: 25
Thanked 215 Times in 202 Posts
it'd be used by test.sh. similar to if you were to do, ./test.sh "$version"
Sponsored Links
    #3  
Old 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 08-15-2013
gacanepa gacanepa is offline
Registered User
 
Join Date: Jun 2013
Last Activity: 28 January 2014, 8:25 AM EST
Location: Villa Mercedes, San Luis, Argentina
Posts: 163
Thanks: 21
Thanked 24 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 08-16-2013
RudiC RudiC is offline Forum Advisor  
Registered User
 
Join Date: Jul 2012
Last Activity: 19 April 2014, 3:26 PM EDT
Location: Aachen, Germany
Posts: 3,525
Thanks: 51
Thanked 820 Times in 783 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 Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 02:14 AM.