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

  • SEARCH
  • Home
  • 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 7087705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:42:25+00:00 2026-05-28T07:42:25+00:00

I have just been playing around with IPython. Currently I am wondering how it

  • 0

I have just been playing around with IPython. Currently I am wondering how it would be possible to run a shell-command with a python variable within a function. For example:

def x(go):
    return !ls -la {go}

x("*.rar")

This gives me “sh: 1: Syntax error: end of file unexpected”. Could anybody please give me a clue on how to let my “x”-function invoke ls like “ls -la *.rar”? There are *.rar files in my working directory.

Thank you in advance,
Rainer

  • 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-28T07:42:25+00:00Added an answer on May 28, 2026 at 7:42 am

    If you look at the history command output, you’ll see that to call external programs ipython uses _ip.system method.

    Hence, this should work for you:

    def x(go):
        return _ip.system("ls -la {0}".format(go))
    

    However, please note that outside ipython you should probably use subprocess.Popen.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm brand new to Google App Engine and have just been playing around with
I've just picked up Resharper and have been playing around converting fields to properties.
I have been playing around with the Gowalla API, and was wondering if anyone
I have just been playing around with status bar notifications and am a bit
I'm new to html5 and have been playing around with the canvas. I'm wondering
I have been playing around with some Python now and start to get a
I've been playing around with postMessage just to have a better understanding of how
I am new to python and have been playing around with it for a
So far I have been just playing around with the Addon SDK and making
i have some sample code i have been playing around with. Basically im just

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.