Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Inputs argument for sh -c

Shell Programming and Scripting


Tags
bash, dash

Reply    
 
Thread Tools Search this Thread Display Modes
    #8  
Old Unix and Linux 6 Days Ago   -   Original Discussion by puertas12
puertas12's Unix or Linux Image
puertas12 puertas12 is offline
Registered User
 
Join Date: Oct 2017
Last Activity: 7 December 2017, 8:11 AM EST
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Basically "sh -s" and "sh -c" do the opposite:
  • With sh -s, commands are read from the std input arguments are passed after the sh -s
  • With sh -c, arguments are read from the std input and commands are passed after the sh -c
Is my understanding correct?
Sponsored Links
    #9  
Old Unix and Linux 6 Days Ago   -   Original Discussion by puertas12
Corona688's Unix or Linux Image
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 13 December 2017, 10:16 AM EST
Location: Saskatchewan
Posts: 22,546
Thanks: 1,159
Thanked 4,286 Times in 3,955 Posts
sh -c does not take arguments from standard input, it does not take arguments at all. It takes the script from an argument.
Sponsored Links
Reply

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
Error:--test: argument expected--Even though i give an argument. harsha85 UNIX for Advanced & Expert Users 2 02-21-2012 12:19 AM
Cannot compare argument in if statement in csh/grep command if argument starts with “-“ sarbjit Shell Programming and Scripting 1 02-21-2011 01:23 AM
get positive number n as argument script must calculate the factorial of its argument I-1 Shell Programming and Scripting 3 04-28-2009 10:24 AM
passing argument to shell script that reads user inputs patjones Shell Programming and Scripting 6 04-10-2009 06:42 PM
How to find the last argument in a argument line? nehagupta2008 UNIX for Dummies Questions & Answers 4 06-20-2008 12:05 PM



All times are GMT -4. The time now is 12:19 AM.