LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-29-2015, 08:33 AM   #1
fawcaz
LQ Newbie
 
Registered: Dec 2009
Posts: 12

Rep: Reputation: 0
what does | bash -s do? any example?


I am trying to understand what | bash -s does

$ echo ls| bash -s sdfdsf <--- seems to be same as $echo ls |bash . What is the -s asdf doing?
 
Old 05-29-2015, 10:31 AM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,131

Rep: Reputation: 1347Reputation: 1347Reputation: 1347Reputation: 1347Reputation: 1347Reputation: 1347Reputation: 1347Reputation: 1347Reputation: 1347Reputation: 1347
Te "-s" tells bash to read a command from stdin even though more arguments follow. The "sdfsdf" will be a positional argument to bash, but the command you are passing does not make use of it. Try this:
Code:
echo 'ls $*' | bash -s sdfsdf
Be sure to use single quotes so that the "$*" is passed literally rather than being expanded (probably to nothing) in the echo command.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[To share Bash knowledge]Notes for Advanced Bash-Scripting Version 10 (Latest) jcky Programming 4 07-31-2014 10:24 AM
[SOLVED] Converting Script from Linux (GNU) Bash 4 to Solaris Bash 2.05 - Any cheat sheet? oly_r Solaris / OpenSolaris 6 05-03-2013 09:25 AM
Bash problem : -bash: [: /bin/bash: unary operator expected J.A.X Linux - Software 1 09-22-2011 06:52 AM
[SOLVED] Using a long Bash command including single quotes and pipes in a Bash script antcore Linux - General 9 07-22-2009 12:10 PM
why did bash 2.05b install delete /bin/bash & "/bin/sh -> bash"? johnpipe Linux - Software 2 06-06-2004 07:42 PM


All times are GMT -5. The time now is 07:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration