Tag Info

Hot answers tagged

4

jobs is not a command, it's a shell builtin. Together with fg, bg and other shell builtins, it is used to manage all of the "jobs" that are running as child processes of the shell: list them, stop them, put them in the foreground, etc... As such, it doesn't make sense outside the context of the shell to which the jobs belong. The equivalent concept in ...


3

@milne's answer works, but subprocess.call() gives you little feedback. I prefer to use subprocess.check_output() so you can analyse what was printed to stdout: import subprocess res = subprocess.check_output(["sudo", "apt", "update']) for line in res.splitlines(): # process the output line by line check_output throws an error on on-zero exit of ...


3

The subprocess module is designed to do this: import subprocess subprocess.call(["sudo", "apt", "update"]) If you would like the script to terminate if the command fails, you might consider using check_call() instead of parsing the return code yourself: subprocess.check_call(["sudo", "apt", "update"])


3

To set things up so that python gets you the new version but everyone else, including the standard OS programs, will get the original: choose a directory to hold your personal programs (or symlinks to them). This could be $HOME/bin or /usr/local/bin, whatever you like. Create it if it doesn't exist. I'll use $HOME/bin in this example. Edit your ...


2

Using the PPA You can use the PPA on Debian. Pick an Ubuntu version that's from slightly before your Debian version, and it should have all the necessary libraries. For wheezy, the oneiric PPA seems ok (but it lacks more recent Python versions). For jessie, the trusty PPA should work. To add a PPA on Debian, create a file ...


2

Get the default route, and catch the interface column: nicolas@host:~$ ip route list | grep default | awk '{print $5} ' wlan0


2

The way to determine whether there are unread mails in a mailbox file is traditionally to check if the access time is earlier than the modification time. You can easily find these times using the stat command; by specifying a custom output format these values can be imported into the shell: eval $(stat -c 'atime=%X; mtime=%Y' /var/spool/mail/$USER) After ...


1

The following commands will remove your make altinstall-ed python: rm -f /usr/local/bin/python2.7 rm -f /usr/local/bin/pip2.7 rm -f /usr/local/bin/pydoc rm -rf /usr/local/bin/include/python2.7 rm -f /usr/local/lib/libpython2.7.a rm -rf /usr/local/lib/python2.7 You might also have to do rm -f /usr/local/share/man/python2.7.1 rm -rf ...


1

how can I make all python scripts with shebang to use the new python? Use the shebang #!/usr/bin/python2.7 Can I also make the command python be the new one? You can name the compiled Python something else e.g. /usr/local/bin/python2.7 and then directly call the binary by full path or create an alias like alias python2.7='/usr/local/bin/python2.7' ...


1

On all recent Fedora releases, /bin is a symlink to /usr/bin — which means if you look in /bin, you actually get redirected to the /usr/bin. However, both appear in $PATH (hmmm; that probably should be cleaned up), and that's what you're seeing with which -a python — two ways to get to an actually-identical binary. So, there's no problem here. (Note, ...


1

The reason this occurs is when you run in sudo mode your current env variables are not retained. If you run your sudo command with the -E switch it will pass your environment variable through. Have a read of man sudo for more details


1

Looks like your $app gets the comma appended for other package names than vim. Try removing the commas from the apps or Try sudo apt-get install $(echo $app | sed 's/,//g') -y instead of sudo apt-get install $app -y and sudo pip install -U $(echo $app | sed 's/,//g') instead of sudo pip install -U $app



Only top voted, non community-wiki answers of a minimum length are eligible