Hot answers tagged

4

You are using an anti-pattern, in that you should never use a for loop to iterate over the output of a find command. It's a little similar to parsing ls output, which you should also never do. Instead, use find's built in ability to run commands: find /home/rmintz/Documents/ -type f -name "*jpg" -exec echo {} \; Here, the {} is replaced with the name of ...


2

sudo does not, by default, use your path, and does not run root's bashrc or equivalent. See http://askubuntu.com/q/128413 for a full description.


2

The sudo configuration by default will reset the path regardless of how sudo is called. Here are two common ways to work around this, the first is the permanent change, the second is a command line argument to sudo (which you could add as an alias). permanent & global change In /etc/sudoers you need to modify two settings: sudo visudo In the sudoers ...


2

I found the GIMP Saver Plugin that does exactly that and a little more. I mapped it to Ctrl+E.  Now Ctrl+E just saves the plain image and I'm done!  perfect!  I left Ctrl+Shift+E to "Export as", which is the only one I use anyway. It is perfect for those times when you have to visually tweak a dozen JPEGs and you can't just use ImageMagick.


2

How do you know that "nothing happens"? Just because the script doesn't pop up in a window on your screen, doesn't mean it is not running. Cron is made for "batch" tasks, not for starting interactive programs, so not only it won't automagically launch a terminal window for you (though that could be done manually), most of the time it can't launch any ...


2

Redirect the stdout to /dev/null by appending > /dev/null to any command: apt-get update > /dev/null To also redirect stderr to /dev/null append 2>&1: apt-get update > /dev/null 2>&1 To upgrade or install packages without being prompted for [Y/n] add -y: apt-get upgrade -y > /dev/null 2>&1 apt-get install ...


2

find can print any of the 3 timestamps a file/directory can have. You just have to use -printf with the appropriate format sequence: %C@ or %A@ or %T@ (see the detail is man find). As for empty directories, checking if $? is 0 can be misleading because 0 return code means "nothing bad has happened", and an empty directory does not count "something bad", ...


1

The cronjob may very well be running - however you have provided no redirection of its output (stdout), so it has no where to be displayed. The tasks launched by cron are responsible for their own logging / output - cron provides no output redirection capability. You can have the the cron job launch a terminal and then run your script in it; here is an ...


1

You can issue the command apt-get install ${package_list} and all packages in the the package-list variable will be installed if possible. There are tools that will give you lists of installed packages. You should remove any packages installed as dependencies, as well as packages installed by default. Look at the command listed by man -k apt. If you ...


1

#!/bin/bash ##Sorry for bad English. ##usage: script_name.sh silicon valley ##This urlencode fonction is from github project but I couldnt remember who is creator. urlencode() { # urlencode <string> local length="${#1}" for (( i = 0; i < length; i++ )); do local c="${1:i:1}" case $c in [a-zA-Z0-9.~_-]) ...



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