Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 982415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:41:33+00:00 2026-05-16T04:41:33+00:00

I tried to run commands using pipes. Basic : single=ls -l $single which works

  • 0

I tried to run commands using pipes.

Basic:

single="ls -l"
$single

which works as expected

Pipes:

multi="ls -l | grep e"
$multi
ls: |: No such file or directory
ls: grep: No such file or directory
ls: e: No such file or directory

…no surprise

bash < $multi

$multi: ambiguous redirect

next try

bash $multi
/bin/ls: /bin/ls: cannot execute binary file

Only

echo $multi > tmp.sh
bash tmp.sh

worked.

Is there a way to execute more complex commands without creating a script for execution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T04:41:33+00:00Added an answer on May 16, 2026 at 4:41 am

    You’re demonstrating the difference between the shell and the kernel.

    “ls -l” is executable by the system execve() call. You can man execve for details, but that’s probably too much detail for you.

    “ls -l | grep e” needs shell interpretation to set up the pipe. Without using a shell, the ‘|’ character is just passed into execve() as an argument to ls. This is why you see the “No such file or directory” errors.

    Solution:

    cmd="ls -l | grep e"
    bash -c "$cmd"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to run some commands via a remote program. I've tried it using
I'm using the runtime to run command prompt commands from my Java program. However,
I'm using P4.Net to connect to my non-unicode server however some commands i run
I'm using python to play with the stackoverflow API. I run the following commands:
I am logged into my server as root and tried to run this command:
I tried to run the following command and it says there is nothing to
The following code utilizes CreateProcess to run commands with environmental variables. Here, it tries
On a rooted android device, I tried to run a cat command that read
How do I run this command with subprocess? I tried: proc = subprocess.Popen( '''ECHO
I tried to run the directx samples from ..\Windows Mobile 6 SDK\Samples\PocketPC\CPP\win32\directx\d3dm\tutorials on a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.