449 reputation
38
bio website sourceforge.net/projects/…
location Northeast
age
visits member for 2 years, 11 months
seen Aug 16 at 5:59

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)


Jun
7
comment How to recover from a chmod -R 000 /bin?
Glad it's fixed. I'm missing something. If it's a vm, then it's just one big file to the host system, isn't it? How do you mount anything inside it to do the repairs? (I understand how to do this on a non-vm system.)
May
11
comment Is it common to split larger script into multiple scripts and source them in the main script?
I have run into the same problem. I have a moderately large bash project sourceforge.net/projects/duplexpr . Currently, each script is self contained, but I am thinking of moving all the common functions to a separate file(s) and including them where needed to eliminate having to update them in multiple places. In general, I think it would be better to just call each successive script rather than source it. It makes running the parts independently possible. Then, you have to pass variables as arguments or in parameter files (or you can just export them if you don't want standalone.)
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
answered What's the most appropriate directory where to place files shared between users?
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.
Mar
15
asked Securely reading and parsing a string from a parameter or file in bash
Mar
9
answered Why is aliasing over standard commands not recommended?
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.