439 reputation
38
bio website sourceforge.net/projects/…
location Northeast
age
visits member for 2 years, 11 months
seen 8 hours ago

Long time Linux user (currently kubuntu). Use Windows 98, and 7 when I have to. Programmed in many languages, currently using bash and awk for most things. Learning Python.

Have one project on sourceforge:

Duplex printing emulator for non-duplex printers (Linux)


May
11
comment Can bash case statements cascade?
+1 Cool. Never noticed that option before.
Apr
5
comment How do you send command line apps directly to the background?
If your task requires your input "before disappearing" into the background, you can use tools like zenity or yad (if you like guis). They can still send and receive output from the background. I'm sure that playing with pipes and devices would also get you access to the console from background, but I'm not sure how to do it.
Apr
5
comment Why doesn't “sudo su” in a shell script run the rest of the script as root?
If using su or sudo was "persistent" in bash (or anywhere else) it would create many more problems than it solved. You need to do the minimum possible as root for safety and security. The main point of having su and sudo (other than security!) is to make you think carefully about what needs root privileges.
Apr
5
comment Why doesn't “sudo su” in a shell script run the rest of the script as root?
@JoelDavis - I've spent many hours dancing with embedded blanks. Using "$@" for argument lists helps. Using eval for commands helps a lot too. The newest trick someone showed me is to put all your arguments into an array and then reference the array as "$ARRAY[@]". That also helps make blanks behave. To detail all of this would require a separate question.
Apr
5
comment Is there a way to prevent the creation of a given file?
I was wondering where that file came from!
Mar
18
comment Securely reading and parsing a string from a parameter or file in bash
I think you're right. I need to go back and do some more testing to see exactly what works and what doesn't.
Mar
18
comment Securely reading and parsing a string from a parameter or file in bash
@UlrichDangel - You're right. It doesn't get expanded in that case. I'll have to do some more testing to see how things like this actually work. Maybe it's not as bad as I thought.
Mar
17
comment Securely reading and parsing a string from a parameter or file in bash
The application I'm currently working on is a personal backup system based on rsync. So far, it needs a small number of global parameters - like where things the scripts need are kept and a number of parameters which define a specific backup task like source, destination, whether the source should be unmounted before proceeding ... all parameter=value pairs, except a few which start out as small arrays.
Mar
17
comment Securely reading and parsing a string from a parameter or file in bash
I must be missing something. If I put my sample input into your code, it looks like it would be executed inside the $() before it even gets into var. Your idea of doing the parameter reading code before the sudo code would limit any damage to one user which is a lot better. I'll have to look at my scripts and see if that approach will fit.
Mar
17
comment Securely reading and parsing a string from a parameter or file in bash
@UlrichDangel Maybe you could point me to some example code. Read or cat into what? I can't put it in a variable, because the variable can't be accessed (or at least, I don't know how to) without subjecting its contents to expansion and, potentially, execution.
Mar
17
comment Securely reading and parsing a string from a parameter or file in bash
@vonbrand My first thought )reflected in my question) was that I might need to use a more conventional language such as python or C, but I was hoping for some ideas within the purview of bash. I downloaded that book and will read it later.
Mar
17
comment Securely reading and parsing a string from a parameter or file in bash
@UlrichDangel gconf is interesting. It's sort of what I was looking for, but way too powerful. It also looks like it may have too many things in it which, if broken, would take the rest of the system with them.
Mar
17
comment Securely reading and parsing a string from a parameter or file in bash
@UlrichDangel - aside from reading the file character by character as I suggested in my question, how do I parse something potentially dangerous in bash? I guess I'd have to pipe the file right into sed or awk or a similar program - other than bash. In bash, there doesn't seem to be a way to treat a string in a variable as just a string, not subject to further expansion.
Feb
14
comment Passing arguments to KOrganizer event reminder bash/yad scripts
I'm still working on it. I couldn't get it to work.
Feb
8
comment How to truely install a tar.gz file on Linux - how to manage manually-installed (or standalone) applications?
Continued ... checkinstall helps prevent that by keeping track of what was installed so it's easier to clean out later.
Feb
8
comment How to truely install a tar.gz file on Linux - how to manage manually-installed (or standalone) applications?
Continued ... Usually, when you install from a tarball, or other standalone package, your package management system doesn't know it's there which means you don't get "automatic" updates and can run into the dependency problems detailed in the answers. I haven't used checkinstall very much, but it seems really helpful. Sometimes, installing a tarball involves a lot of other packages getting installed (manually by you) to satisfy dependencies. The problem is that I don't keep good notes and when I want to get rid of the package, all the other stuff ends up as clutter on my system.
Feb
8
comment How to truely install a tar.gz file on Linux - how to manage manually-installed (or standalone) applications?
The biggest technical thing I don't like about Windows is the registry. It causes many more problems than it's worth and is why so many installs include a reboot. Thankfully, Linux has no such thing! What it does have is package management systems and repositories which make it easier to find and install software already configured for your distro and desktop environment. One of the major advantages of using these is that when a developer updates their software package, it automagically becomes available as an update for your system.
Feb
8
comment How to truely install a tar.gz file on Linux - how to manage manually-installed (or standalone) applications?
Great answer. One thing that is often necessary (or at least preferred) is to do a sudo make install as the last step (with a package you trust). That gives the process the permissions it needs to put things in system directories not owned by your user (like /usr/bin).
Feb
3
comment How to Find a Fugitive Crontab
+1 because it shows how to get the problem to explain itself!
Jan
29
comment Passing arguments to KOrganizer event reminder bash/yad scripts
I'll try that as soon as I can get back to it in a day or two. Since there's really nothing shell-like left to be done, Just leaving it in single quotes would probably be fine - unless my text has some embedded ones.