News for hackers. Stuff that matters.
Re:Safe ways to do things in bash by yAnonymous on Tuesday May 15, 2018 @06:36AM (#17072954)
Is there an easy way to run shell commands in Python, like backticks in PERL, Ruby or even PHP?

I'd really like to use Python more often, but most of the time it only complicates things with those verbose syscalls.

Re:Safe ways to do things in bash by passwd on Tuesday May 15, 2018 @10:38AM (#17074215)
IPython. Seems to work for simple stuff like `ls blah`, but I'm not aware how far this stretches, and is probably not super safe to use.

EDIT: Seems I've only tried too basic things - it works thanks to %automagic, and seemingly %man is a thing. Other option is to use %%sh or %%bash, but that's a bit verbose.

Re:Safe ways to do things in bash by monort on Tuesday May 15, 2018 @07:08AM (#17073085)
Check out python sh: https://github.com/amoffat/sh
Re:Safe ways to do things in bash by yAnonymous on Tuesday May 15, 2018 @09:02AM (#17073585)
>sh.ls("-l", "/tmp", color="never")

Nope. I really need to be able to test commands on the terminal and then copy/paste them without any modifications. I won't even try to get used to that stupid syntax.

Re:Safe ways to do things in bash by neillyons on Tuesday May 15, 2018 @06:57AM (#17073041)
Unfortunately not. I have used Ruby a little bit and that is really nice feature.
Re:Safe ways to do things in bash by rcxdude on Tuesday May 15, 2018 @11:42AM (#17074807)
part of the complication is due to actually having the proper data seperation that you need to jump through hoops to get in bash. If you go with backtick style calls you lose a lot of that.
Re:Safe ways to do things in bash by sxv on Tuesday May 15, 2018 @02:08PM (#17076182)