0

I am writing this script that executes a bunch of commands one of which is to download some packages from a certain url.

Following is my script

#! /usr/bin/env python
#! /usr/bin/env bash

import os 
import sys 
import subprocess


url = sys.argv[1] 
getRpm = "'wget %s' %url"
searchRpm = "rpm -qa|grep sys.*"
execsCmds = [getRpm,searchRpm]

def runCommands(commands=execsCmds):
    for cmd in execsCmds:
        print "Running Command"
        subprocess.call(cmd, shell=True)

runCommands()

When I execute is it says:

/bin/sh: wget %s: command not found
2
  • 1
    Sidenote: "#! /usr/bin/env bash" is obsolete. Either this a python-script or a bash-script. It can't be both.
    – MadMike
    Jan 23, 2015 at 8:32
  • Where do you tell wget what is to be inserted in %s and %url?
    – s3lph
    Jan 25, 2015 at 14:13

1 Answer 1

1

Your line that constructs getRpm should probably be:

getRpm = 'wget %s' %url

Basically, just remove the extra double-quotes.

0

Not the answer you're looking for? Browse other questions tagged .