0
votes
0answers
14 views

How to execute a long shell command with parameters in Python? [closed]

This is a shell command that makes an xml from a pcap file: tshark -r something.pcap -T pdml > someting.xml I want to write a python script that does this automatically with all the pcap files ...
0
votes
2answers
31 views

How to save the stdout and stderr to a file while still seeing the output?

I'm trying to debug a program that generates a lot of data. But the event which I want to debug happens after a random amount of time (I cannot force it). So I would need to see the stdout and stderr ...
2
votes
2answers
46 views

How do I handle multiple quotes in an alias (for bash or zsh)

I am using zsh, and I am trying to use python as a simple calculator. I'm very familiar with python, but can't seem to get the alias (or function) to work properly. So far I've got: pycalc() { ...
0
votes
1answer
28 views

Batch APPEND (RENAME) a specific keyword to set of files

I have few files namely - "a", "b", "c",etc.. I want to add the keyword: ".mov" to all files in that folder. Please suggest me an approach which script will be best suited for this - AppleScript, ...
0
votes
2answers
23 views

Batch TRIM (RENAME) a specific keyword from set of files

I have few files namely - "a.mov-, attachment", "b.mov-, attachment", "c.mov-, attachment",etc.. I want to trim the keyword: "-, attachment" from all files in that folder. Please suggest me an ...
0
votes
4answers
318 views

Batch file rename script swapping substrings in filename?

I have a group of files named like title_december_word1_word2.png and want to iterate through the directory and swap word1 and word2 within each file. i.e. go from "button_december_state_pressed.png" ...
1
vote
1answer
388 views

extract characters between first and second underscores of filenames and count such files in linux folder

I would like to extract characters between first and second underscores of filenames in a folder and count such type of files present in it. The folder contains files in a particular format such as : ...
1
vote
0answers
127 views

Mac: Run screen command from launchctl

I have a Python script that I would like to run on a Mac at system start up in a detached screen session. The Python File (foo.py): import time import datetime while True: print 'hello', ...
0
votes
0answers
32 views

How can I add a contextual menu that will work ONLY on files of a specific folder?

I have been looking around and it's hard to find what I want. I know how to add context menus for files of particular extension through registry edit. I need to have context menu for all the files in ...
2
votes
1answer
113 views

How do you call ActivePython from cygwin shell?

I installed ActivePython which is a Python version 3.x installation for Windows. I renamed the interpreter to be activepython.exe so as to allow calling it from cygwin without modifying /etc/profile ...
0
votes
2answers
425 views

How to execute a chained set of linux commands from python

Following is an example of a shell command I'd like to execute verbatim. Any way to do this in python (i.e. similar to the %x{command} construct in ruby that will take anything you give it.. kill -9 ...
4
votes
2answers
133 views

determine where python is running from in linux

I normally work in python on Windows and I use the dos command where python to make sure that I am using the virtual environments version of python. What is the equivalent command in the linux shell? ...
0
votes
1answer
226 views

script to convert GB to TB

I have (multiple) files like below list. Few of them has both the values in TB and couple of files in GB. Now if you clearly see the file output there are two rows with Total capacity and Capacity ...
1
vote
1answer
90 views

disowning a process before it starts

Is it possible to disown a job at startup w/ out manually pausing the process? Basically the issue is, is that I'm iterating through a number of processes using a python script. I can manually disown ...
0
votes
2answers
142 views

ssh warning message

Is there a way to avoid ssh login warning messages while login to remote server through scripts? But I do not want to change any configurations in remote server, but in scripts or any options.
7
votes
2answers
102 views

Is it possible to modify bash to run one command through another (say a python script)?

I was wondering if it is possible to modify bash such that when I type command --arg1 what actually happens is ~/prerun.py command --arg1 (prerun.py would handle starting command --arg1 itself) ...
1
vote
1answer
122 views

Unpack this directory into your PYTHONPATH?

I want to install qt4reactor so I went to the github page, it says: Unpack this directory into your PYTHONPATH I don't know what that means. I unziped the file and I tried to add the path to ...
3
votes
1answer
244 views

Can I redo/undo in ipython shell?

A feature in bpython called rewind. Is there some similar key bindings?
1
vote
1answer
478 views

Character encoding after shebang in shell scripts?

I came across some Ruby scripts on Github. The first line is the normal shebang (#!/usr/bin/ruby), but the second line is the following: # -*- coding: utf-8 -*- I didn't know this method of ...
5
votes
2answers
10k views

“bad interpreter: Permission denied” How can I prevent this error?

I want to run program directly such as ./program without define the interpreter in shell first. so, how can i want to prevent this error? bad interpreter: Permission denied My operating system ...
2
votes
3answers
3k views

Ubuntu 10.10 'Command not found' for python script

I have a python script 'monty.py' with #!/usr/bin/env python in the first line. When I run monty.py in the terminal, I get monty.py: command not found I am in the correct directory, and I also ...
1
vote
2answers
689 views

Shell Script File - Pass Multiple Parameters to Interpreter

I have a Python script that I run which needs to execute under a special environment, so I would run the program like so from my working directory (~/project/src): python manage.py shell This opens ...
2
votes
1answer
1k views

Mac OS X: Update Python for Shell [duplicate]

Possible Duplicate: Using Python on Mac So, I see similar questions, but none of the answers work for me. I updated Python to 3.1.3 from 2.6.1. Everything works, except: When I type python ...
1
vote
4answers
2k views

Python: Check existence of shell command before execution

I'm trying to find a way to check the existence of a shell command before its execution. For example, I'll execute the command ack-grep. So, I'm trying to do: import subprocess from subprocess ...
8
votes
3answers
717 views

`which python` points to the python I want, but `python` runs the wrong version

I want to use python24 provided by ports, so I've installed it, and python_select -s shows that the version I want is indeed selected. Running which python gives /opt/local/bin/python, and running ...